diff options
Diffstat (limited to 'db/repl.h')
-rw-r--r-- | db/repl.h | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/db/repl.h b/db/repl.h index 9a66bfbde41..0ea6b31e6f4 100644 --- a/db/repl.h +++ b/db/repl.h @@ -1,5 +1,5 @@ -// repl.h - replication
-
+// repl.h - replication + /** * Copyright (C) 2008 10gen Inc. * @@ -15,9 +15,45 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* replication data overview + + at the slave: + local.sources { host: ..., source: ..., syncedTo: } +*/ + +#pragma once + +bool cloneFrom(const char *masterHost, string& errmsg); -#pragma once
-
-bool cloneFrom(const char *masterHost, string& errmsg);
-
-
+#pragma pack(push)
+#pragma pack(4)
+class OpTime {
+ unsigned secs;
+ unsigned i;
+public:
+ OpTime(unsigned a, unsigned b) { secs = a; i = b; }
+ OpTime() { secs = 0; i = 0; }
+ static OpTime now();
+ double& asDouble() { return *((double *) this); }
+ bool isNull() { return secs == 0; }
+};
+#pragma pack(pop)
+ +/* A Source is a source from which we can pull (replicate) data. + stored in collection local.sources. + + Can be a group of things to replicate for several databases. +*/ +class Source { +public: + string hostName; + string sourceName; + OpTime syncedTo; + static void loadAll(vector<Source*>&); + static void cleanup(vector<Source*>&); + Source(JSObj); + void pull(); + void updateOnDisk(); + JSObj jsobj(); // { host: ..., source: ..., syncedTo: } +}; |