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

Unified Diff: blimp/net/helium/vector_clock_generator.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/vector_clock.cc ('k') | blimp/net/helium/vector_clock_generator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/net/helium/vector_clock_generator.h
diff --git a/blimp/net/helium/vector_clock_generator.h b/blimp/net/helium/vector_clock_generator.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f4160b5a3709d8edbdee3382e77a84877300700
--- /dev/null
+++ b/blimp/net/helium/vector_clock_generator.h
@@ -0,0 +1,33 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BLIMP_NET_HELIUM_VECTOR_CLOCK_GENERATOR_H_
+#define BLIMP_NET_HELIUM_VECTOR_CLOCK_GENERATOR_H_
+
+#include "base/macros.h"
+#include "blimp/net/helium/vector_clock.h"
+
+namespace blimp {
+
+// This entity is responsible for generating monotonically increasing values
+// of VectorClocks. This generator is going to be used one per host
+// (client or engine) to ensure they have a single clock domain.
+//
+class VectorClockGenerator {
+ public:
+ VectorClockGenerator() {}
+
+ void Increment() { clock_.IncrementLocal(); }
+
+ const VectorClock& current() { return clock_; }
+
+ private:
+ VectorClock clock_;
+
+ DISALLOW_COPY_AND_ASSIGN(VectorClockGenerator);
+};
+
+} // namespace blimp
+
+#endif // BLIMP_NET_HELIUM_VECTOR_CLOCK_GENERATOR_H_
« no previous file with comments | « blimp/net/helium/vector_clock.cc ('k') | blimp/net/helium/vector_clock_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698