summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/roll_back_local_operations.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/roll_back_local_operations.h')
-rw-r--r--src/mongo/db/repl/roll_back_local_operations.h90
1 files changed, 44 insertions, 46 deletions
diff --git a/src/mongo/db/repl/roll_back_local_operations.h b/src/mongo/db/repl/roll_back_local_operations.h
index 4a9d5b71cd8..20eb923083d 100644
--- a/src/mongo/db/repl/roll_back_local_operations.h
+++ b/src/mongo/db/repl/roll_back_local_operations.h
@@ -39,57 +39,55 @@
namespace mongo {
namespace repl {
- class RollBackLocalOperations {
- MONGO_DISALLOW_COPYING(RollBackLocalOperations);
- public:
+class RollBackLocalOperations {
+ MONGO_DISALLOW_COPYING(RollBackLocalOperations);
- /**
- * Type of function to roll back an operation or process it for future use.
- * It can return any status except ErrorCodes::NoSuchKey. See onRemoteOperation().
- */
- using RollbackOperationFn = stdx::function<Status (const BSONObj&)>;
-
- using RollbackCommonPoint = std::pair<Timestamp, RecordId>;
-
- /**
- * Initializes rollback processor with a valid local oplog.
- * Whenever we encounter an operation in the local oplog that has to be rolled back,
- * we will pass it to 'rollbackOperation'.
- */
- RollBackLocalOperations(const OplogInterface& localOplog,
- const RollbackOperationFn& rollbackOperation);
-
- virtual ~RollBackLocalOperations() = default;
-
- /**
- * Process single remote operation.
- * Returns ErrorCodes::NoSuchKey if common point has not been found and
- * additional operations have to be read from the remote oplog.
- */
- StatusWith<RollbackCommonPoint> onRemoteOperation(const BSONObj& operation);
+public:
+ /**
+ * Type of function to roll back an operation or process it for future use.
+ * It can return any status except ErrorCodes::NoSuchKey. See onRemoteOperation().
+ */
+ using RollbackOperationFn = stdx::function<Status(const BSONObj&)>;
- private:
+ using RollbackCommonPoint = std::pair<Timestamp, RecordId>;
- std::unique_ptr<OplogInterface::Iterator> _localOplogIterator;
- RollbackOperationFn _rollbackOperation;
- OplogInterface::Iterator::Value _localOplogValue;
- unsigned long long _scanned;
+ /**
+ * Initializes rollback processor with a valid local oplog.
+ * Whenever we encounter an operation in the local oplog that has to be rolled back,
+ * we will pass it to 'rollbackOperation'.
+ */
+ RollBackLocalOperations(const OplogInterface& localOplog,
+ const RollbackOperationFn& rollbackOperation);
- };
+ virtual ~RollBackLocalOperations() = default;
/**
- * Rolls back every operation in the local oplog that is not in the remote oplog, in reverse
- * order.
- *
- * Whenever we encounter an operation in the local oplog that has to be rolled back,
- * we will pass it to 'rollbackOperation' starting with the most recent operation.
- * It is up to 'rollbackOperation' to roll back this operation immediately or
- * process it for future use.
+ * Process single remote operation.
+ * Returns ErrorCodes::NoSuchKey if common point has not been found and
+ * additional operations have to be read from the remote oplog.
*/
- StatusWith<RollBackLocalOperations::RollbackCommonPoint> syncRollBackLocalOperations(
- const OplogInterface& localOplog,
- const OplogInterface& remoteOplog,
- const RollBackLocalOperations::RollbackOperationFn& rollbackOperation);
+ StatusWith<RollbackCommonPoint> onRemoteOperation(const BSONObj& operation);
+
+private:
+ std::unique_ptr<OplogInterface::Iterator> _localOplogIterator;
+ RollbackOperationFn _rollbackOperation;
+ OplogInterface::Iterator::Value _localOplogValue;
+ unsigned long long _scanned;
+};
+
+/**
+ * Rolls back every operation in the local oplog that is not in the remote oplog, in reverse
+ * order.
+ *
+ * Whenever we encounter an operation in the local oplog that has to be rolled back,
+ * we will pass it to 'rollbackOperation' starting with the most recent operation.
+ * It is up to 'rollbackOperation' to roll back this operation immediately or
+ * process it for future use.
+ */
+StatusWith<RollBackLocalOperations::RollbackCommonPoint> syncRollBackLocalOperations(
+ const OplogInterface& localOplog,
+ const OplogInterface& remoteOplog,
+ const RollBackLocalOperations::RollbackOperationFn& rollbackOperation);
-} // namespace repl
-} // namespace mongo
+} // namespace repl
+} // namespace mongo