diff options
Diffstat (limited to 'util/lamport/clock.go')
-rw-r--r-- | util/lamport/clock.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/util/lamport/clock.go b/util/lamport/clock.go new file mode 100644 index 00000000..53b0ac7a --- /dev/null +++ b/util/lamport/clock.go @@ -0,0 +1,15 @@ +package lamport + +// Time is the value of a Clock. +type Time uint64 + +// Clock is a Lamport logical clock +type Clock interface { + // Time is used to return the current value of the lamport clock + Time() Time + // Increment is used to return the value of the lamport clock and increment it afterwards + Increment() (Time, error) + // Witness is called to update our local clock if necessary after + // witnessing a clock value received from another process + Witness(time Time) error +} |