Chromium Code Reviews| 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..a5f97ac59493cb2c6dcf1a41d19919f957fc95bc |
| --- /dev/null |
| +++ b/blimp/net/helium/vector_clock_generator.h |
| @@ -0,0 +1,37 @@ |
| +// 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. These generators are going to be used one per host |
|
Kevin M
2016/10/05 23:41:30
"These generators" - there's only one of them?
scf
2016/10/06 19:47:17
Done.
|
| +// (client or engine) to ensure they have a single clock domain. |
| +// |
| +// This greatly simplify things as VectorClocks will be behaving similar to time |
|
Kevin M
2016/10/05 23:41:30
Paragraph seems like a design doc detail.
scf
2016/10/06 19:47:17
removed
|
| +// concept. VectorClocks of different objects in the same host can be compared |
| +// directly and well as VectorClocks between different objects in different |
| +// hosts (As long as you invert local and remote pairs). |
| +class VectorClockGenerator { |
| + public: |
| + VectorClockGenerator() {} |
| + |
| + void increment() { clock_.IncrementLocal(); } |
|
Kevin M
2016/10/05 23:41:30
capital I Increment()
|
| + |
| + const VectorClock& current() { return clock_; } |
| + |
| + private: |
| + VectorClock clock_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(VectorClockGenerator); |
| +}; |
| + |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_NET_HELIUM_VECTOR_CLOCK_GENERATOR_H_ |