diff options
author | Benety Goh <benety@mongodb.com> | 2016-12-06 15:13:17 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2016-12-07 10:11:50 -0500 |
commit | b666c293b8dee59b0bb8926afafc6eebf9c7d21c (patch) | |
tree | 3bdc6f54dea3aec82cbdad525e8edc2ec1541936 /src/mongo/db/op_observer.h | |
parent | 27b1e9a1d61fdd522df5376495859cf9f63725a9 (diff) | |
download | mongo-b666c293b8dee59b0bb8926afafc6eebf9c7d21c.tar.gz |
SERVER-27301 converted OpObserver into an interface. ServiceContext should always return a valid OpObserver implementation.
Diffstat (limited to 'src/mongo/db/op_observer.h')
-rw-r--r-- | src/mongo/db/op_observer.h | 84 |
1 files changed, 44 insertions, 40 deletions
diff --git a/src/mongo/db/op_observer.h b/src/mongo/db/op_observer.h index e9c6f7d7425..15b63d89c0c 100644 --- a/src/mongo/db/op_observer.h +++ b/src/mongo/db/op_observer.h @@ -63,22 +63,22 @@ class OpObserver { MONGO_DISALLOW_COPYING(OpObserver); public: - OpObserver() {} - ~OpObserver() {} + OpObserver() = default; + virtual ~OpObserver() = default; - void onCreateIndex(OperationContext* txn, - const std::string& ns, - BSONObj indexDoc, - bool fromMigrate = false); - void onInserts(OperationContext* txn, - const NamespaceString& ns, - std::vector<BSONObj>::const_iterator begin, - std::vector<BSONObj>::const_iterator end, - bool fromMigrate = false); - void onUpdate(OperationContext* txn, const OplogUpdateEntryArgs& args); - CollectionShardingState::DeleteState aboutToDelete(OperationContext* txn, - const NamespaceString& ns, - const BSONObj& doc); + virtual void onCreateIndex(OperationContext* txn, + const std::string& ns, + BSONObj indexDoc, + bool fromMigrate) = 0; + virtual void onInserts(OperationContext* txn, + const NamespaceString& ns, + std::vector<BSONObj>::const_iterator begin, + std::vector<BSONObj>::const_iterator end, + bool fromMigrate) = 0; + virtual void onUpdate(OperationContext* txn, const OplogUpdateEntryArgs& args) = 0; + virtual CollectionShardingState::DeleteState aboutToDelete(OperationContext* txn, + const NamespaceString& ns, + const BSONObj& doc) = 0; /** * Handles logging before document is deleted. * @@ -88,31 +88,35 @@ public: * so should be ignored by the user as an internal maintenance operation and not a * real delete. */ - void onDelete(OperationContext* txn, - const NamespaceString& ns, - CollectionShardingState::DeleteState deleteState, - bool fromMigrate); - void onOpMessage(OperationContext* txn, const BSONObj& msgObj); - void onCreateCollection(OperationContext* txn, - const NamespaceString& collectionName, - const CollectionOptions& options, - const BSONObj& idIndex); - void onCollMod(OperationContext* txn, const std::string& dbName, const BSONObj& collModCmd); - void onDropDatabase(OperationContext* txn, const std::string& dbName); - void onDropCollection(OperationContext* txn, const NamespaceString& collectionName); - void onDropIndex(OperationContext* txn, - const std::string& dbName, - const BSONObj& idxDescriptor); - void onRenameCollection(OperationContext* txn, - const NamespaceString& fromCollection, - const NamespaceString& toCollection, - bool dropTarget, - bool stayTemp); - void onApplyOps(OperationContext* txn, const std::string& dbName, const BSONObj& applyOpCmd); - void onEmptyCapped(OperationContext* txn, const NamespaceString& collectionName); - void onConvertToCapped(OperationContext* txn, - const NamespaceString& collectionName, - double size); + virtual void onDelete(OperationContext* txn, + const NamespaceString& ns, + CollectionShardingState::DeleteState deleteState, + bool fromMigrate) = 0; + virtual void onOpMessage(OperationContext* txn, const BSONObj& msgObj) = 0; + virtual void onCreateCollection(OperationContext* txn, + const NamespaceString& collectionName, + const CollectionOptions& options, + const BSONObj& idIndex) = 0; + virtual void onCollMod(OperationContext* txn, + const std::string& dbName, + const BSONObj& collModCmd) = 0; + virtual void onDropDatabase(OperationContext* txn, const std::string& dbName) = 0; + virtual void onDropCollection(OperationContext* txn, const NamespaceString& collectionName) = 0; + virtual void onDropIndex(OperationContext* txn, + const std::string& dbName, + const BSONObj& idxDescriptor) = 0; + virtual void onRenameCollection(OperationContext* txn, + const NamespaceString& fromCollection, + const NamespaceString& toCollection, + bool dropTarget, + bool stayTemp) = 0; + virtual void onApplyOps(OperationContext* txn, + const std::string& dbName, + const BSONObj& applyOpCmd) = 0; + virtual void onEmptyCapped(OperationContext* txn, const NamespaceString& collectionName) = 0; + virtual void onConvertToCapped(OperationContext* txn, + const NamespaceString& collectionName, + double size) = 0; }; } // namespace mongo |