summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/data_replicator_external_state.h
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2016-05-20 11:45:27 -0400
committerBenety Goh <benety@mongodb.com>2016-05-24 18:56:07 -0400
commit974ed0ec1799916af2ae12da1d17ac5fc920d966 (patch)
treeb60912c976fc1b9bb2b845b48964cfc2c5d485dd /src/mongo/db/repl/data_replicator_external_state.h
parent8644fe41cc27f1052d602ce5980a95eb551833a9 (diff)
downloadmongo-974ed0ec1799916af2ae12da1d17ac5fc920d966.tar.gz
SERVER-23308 integrated repl::multiApply into data replicator
Diffstat (limited to 'src/mongo/db/repl/data_replicator_external_state.h')
-rw-r--r--src/mongo/db/repl/data_replicator_external_state.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mongo/db/repl/data_replicator_external_state.h b/src/mongo/db/repl/data_replicator_external_state.h
index 983290a2148..d19f46f9711 100644
--- a/src/mongo/db/repl/data_replicator_external_state.h
+++ b/src/mongo/db/repl/data_replicator_external_state.h
@@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/disallow_copying.h"
+#include "mongo/db/repl/multiapplier.h"
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/optime_with.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
@@ -38,6 +39,8 @@
namespace mongo {
namespace repl {
+class DataReplicator;
+
/**
* Holds current term and last committed optime necessary to populate find/getMore command requests.
*/
@@ -76,6 +79,37 @@ public:
virtual bool shouldStopFetching(const HostAndPort& source,
const OpTime& sourceOpTime,
bool sourceHasSyncSource) = 0;
+
+private:
+ /**
+ * Applies the operations described in the oplog entries contained in "ops" using the
+ * "applyOperation" function.
+ *
+ * Used exclusively by the DataReplicator to construct a MultiApplier.
+ */
+ virtual StatusWith<OpTime> _multiApply(OperationContext* txn,
+ const MultiApplier::Operations& ops,
+ MultiApplier::ApplyOperationFn applyOperation) = 0;
+
+ /**
+ * Used by _multiApply() to write operations to database during steady state replication.
+ *
+ * Used exclusively by the DataReplicator to construct a MultiApplier.
+ */
+ virtual void _multiSyncApply(const MultiApplier::Operations& ops) = 0;
+
+ /**
+ * Used by _multiApply() to write operations to database during initial sync.
+ * Fetches missing documents from "source".
+ *
+ * Used exclusively by the DataReplicator to construct a MultiApplier.
+ */
+ virtual void _multiInitialSyncApply(const MultiApplier::Operations& ops,
+ const HostAndPort& source) = 0;
+
+ // Provides DataReplicator with access to _multiApply, _multiSyncApply and
+ // _multiInitialSyncApply.
+ friend class DataReplicator;
};
} // namespace repl