aboutsummaryrefslogtreecommitdiffstats
path: root/util/lamport/clock.go
blob: 53b0ac7a97871a394ff5ea83b4726cf7e96a463f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
}