Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1096)

Unified Diff: blimp/net/helium/vector_clock.h

Issue 2382533002: Helium: Initial proto and Syncable interface definition (Closed)
Patch Set: test changes Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/net/helium/syncable_unittest.cc ('k') | blimp/net/helium/vector_clock.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/net/helium/vector_clock.h
diff --git a/blimp/net/helium/vector_clock.h b/blimp/net/helium/vector_clock.h
index 8028c0268d3706081fba1d2b409c3593fbd33b8c..c54139ddde2489830500a7f24062238631700185 100644
--- a/blimp/net/helium/vector_clock.h
+++ b/blimp/net/helium/vector_clock.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include "blimp/common/proto/helium.pb.h"
#include "blimp/net/blimp_net_export.h"
namespace blimp {
@@ -20,7 +21,7 @@ namespace blimp {
// For more info see:
// https://en.wikipedia.org/wiki/Vector_clock
-typedef uint32_t Revision;
+typedef uint64_t Revision;
class BLIMP_NET_EXPORT VectorClock {
public:
@@ -28,6 +29,7 @@ class BLIMP_NET_EXPORT VectorClock {
VectorClock(Revision local_revision, Revision remote_revision);
VectorClock();
+ VectorClock(const VectorClock&) = default;
// Compares two vector clocks. There are 4 possibilities for the result:
// * LessThan: One revision is equal and for the other is smaller.
@@ -58,6 +60,14 @@ class BLIMP_NET_EXPORT VectorClock {
remote_revision_ = remote_revision;
}
+ // Create the proto message corresponding to this object.
+ proto::VectorClockMessage ToProto() const;
+
+ // Inverts the local and remote components respectively.
+ // Used when we send VectorClock across the wire. The local becomes
+ // remote and vice versa.
+ VectorClock Invert() const;
+
private:
Revision local_revision_ = 0;
Revision remote_revision_ = 0;
« no previous file with comments | « blimp/net/helium/syncable_unittest.cc ('k') | blimp/net/helium/vector_clock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698