diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/FreezeScript/TransformVisitor.h | 5 | ||||
-rw-r--r-- | cpp/src/FreezeScript/Transformer.cpp | 20 | ||||
-rw-r--r-- | cpp/src/FreezeScript/Transformer.h | 2 |
3 files changed, 21 insertions, 6 deletions
diff --git a/cpp/src/FreezeScript/TransformVisitor.h b/cpp/src/FreezeScript/TransformVisitor.h index b3df9adbc1b..8d594fb3193 100644 --- a/cpp/src/FreezeScript/TransformVisitor.h +++ b/cpp/src/FreezeScript/TransformVisitor.h @@ -67,6 +67,11 @@ public: virtual void executeCustomTransform(const DataPtr&, const DataPtr&) = 0; // + // The facet name of the database (evictor only). + // + virtual std::string facetName() = 0; + + // // Indicates whether objects should be removed if no class definition is found. // virtual bool purgeObjects() = 0; diff --git a/cpp/src/FreezeScript/Transformer.cpp b/cpp/src/FreezeScript/Transformer.cpp index b070146b0b9..9628338e30f 100644 --- a/cpp/src/FreezeScript/Transformer.cpp +++ b/cpp/src/FreezeScript/Transformer.cpp @@ -56,6 +56,7 @@ struct TransformInfoI : public TransformInfo virtual bool doBaseTransform(const Slice::ClassDefPtr&); virtual Slice::TypePtr getRenamedType(const Slice::TypePtr&); virtual void executeCustomTransform(const DataPtr&, const DataPtr&); + virtual string facetName(); virtual bool purgeObjects(); virtual ObjectDataMap& getObjectDataMap(); @@ -63,9 +64,9 @@ struct TransformInfoI : public TransformInfo Slice::UnitPtr oldUnit; Slice::UnitPtr newUnit; Db* oldDb; - DbTxn* oldDbTxn; Db* newDb; DbTxn* newDbTxn; + string facet; bool purge; ErrorReporterPtr errorReporter; TransformDataFactoryPtr factory; @@ -1884,7 +1885,7 @@ FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& sym) // Iterate over the database. // Dbc* dbc = 0; - _info->oldDb->cursor(_info->oldDbTxn, &dbc, 0); + _info->oldDb->cursor(0, &dbc, 0); try { Dbt dbKey, dbValue; @@ -1984,6 +1985,8 @@ FreezeScript::RecordDescriptor::transformRecord(IceInternal::BasicStream& inKey, Destroyer<DataPtr> newKeyDataDestroyer(newKeyData); DataPtr newValueData = _info->factory->create(_info->newValueType, false); Destroyer<DataPtr> newValueDataDestroyer(newValueData); + DataPtr facetData = _info->factory->createString(_info->facet, true); + Destroyer<DataPtr> facetDataDestroyer(facetData); // // Copy the data from the old key and value to the new key and value, if possible. @@ -2005,6 +2008,7 @@ FreezeScript::RecordDescriptor::transformRecord(IceInternal::BasicStream& inKey, st->add("newkey", newKeyData); st->add("oldvalue", oldValueData); st->add("newvalue", newValueData); + st->add("facet", facetData); ExecutableContainerDescriptor::execute(st); } @@ -2706,6 +2710,12 @@ FreezeScript::TransformInfoI::executeCustomTransform(const DataPtr& dest, const } } +string +FreezeScript::TransformInfoI::facetName() +{ + return facet; +} + bool FreezeScript::TransformInfoI::purgeObjects() { @@ -2921,17 +2931,17 @@ FreezeScript::assignOrTransform(const DataPtr& dest, const DataPtr& src, bool co void FreezeScript::transformDatabase(const Ice::CommunicatorPtr& communicator, const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit, - Db* oldDb, DbTxn* oldDbTxn, Db* newDb, DbTxn* newDbTxn, - bool purgeObjects, ostream& errors, bool suppress, istream& is) + Db* oldDb, Db* newDb, DbTxn* newDbTxn, const string& facetName, bool purgeObjects, + ostream& errors, bool suppress, istream& is) { TransformInfoIPtr info = new TransformInfoI; info->communicator = communicator; info->oldUnit = oldUnit; info->newUnit = newUnit; info->oldDb = oldDb; - info->oldDbTxn = oldDbTxn; info->newDb = newDb; info->newDbTxn = newDbTxn; + info->facet = facetName; info->purge = purgeObjects; info->errorReporter = new ErrorReporter(errors, suppress); info->factory = new TransformDataFactory(communicator, newUnit, info->errorReporter); diff --git a/cpp/src/FreezeScript/Transformer.h b/cpp/src/FreezeScript/Transformer.h index 2deda6b556a..a40118f3f2d 100644 --- a/cpp/src/FreezeScript/Transformer.h +++ b/cpp/src/FreezeScript/Transformer.h @@ -26,7 +26,7 @@ namespace FreezeScript void transformDatabase(const Ice::CommunicatorPtr&, const Slice::UnitPtr&, const Slice::UnitPtr&, - Db*, DbTxn*, Db*, DbTxn*, bool, std::ostream&, bool, std::istream&); + Db*, Db*, DbTxn*, const std::string&, bool, std::ostream&, bool, std::istream&); } // End of namespace FreezeScript |