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

Side by Side Diff: blimp/net/helium/vector_clock.h

Issue 2372903002: Helium: Adding vector clock (Closed)
Patch Set: allowing merge with conflicted vectors 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BLIMP_NET_HELIUM_VECTOR_CLOCK_H_
6 #define BLIMP_NET_HELIUM_VECTOR_CLOCK_H_
7
8 #include <cinttypes>
Kevin M 2016/09/27 17:31:10 <stdint.h> is used more frequently
scf 2016/09/27 18:29:59 Done.
9
10 #include "blimp/net/blimp_net_export.h"
11
12 namespace blimp {
13
14 class BLIMP_NET_EXPORT VectorClock {
Kevin M 2016/09/27 17:31:10 Add comment to class describing what vector clocks
scf 2016/09/27 18:29:59 Done.
15 public:
16 VectorClock(int32_t local_revision, int32_t remote_revision);
Kevin M 2016/09/27 17:31:10 Does it make sense to have a default -public const
scf 2016/09/27 18:29:59 Agree, default public makes sense.
17
18 enum class Comparison { LessThan, EqualTo, GreaterThan, Conflicts };
Kevin M 2016/09/27 17:31:10 Enums go at the top of public:
Kevin M 2016/09/27 17:31:10 Potentially misguided language nit: What about "C
scf 2016/09/27 18:29:59 Done.
scf 2016/09/27 18:29:59 Done.
19
20 Comparison CompareTo(const VectorClock& other) const;
Kevin M 2016/09/27 17:31:10 Add comments for all public members except maybe t
scf 2016/09/27 18:29:59 Done.
21 VectorClock MergeWith(const VectorClock& other);
22 void IncrementLocal();
23
24 int32_t local_revision() { return local_revision_; }
25 int32_t remote_revision() { return remote_revision_; }
26
27 private:
28 int32_t local_revision_ = 0;
29 int32_t remote_revision_ = 0;
30 };
31
32 } // namespace blimp
33
34 #endif // BLIMP_NET_HELIUM_VECTOR_CLOCK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698