Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock struct {
// contains filtered or unexported fields
}
Clock is a thread safe implementation of a lamport clock. It uses efficient atomic operations for all of its functions, falling back to a heavy lock only if there are enough CAS failures.
func NewClock ¶
func NewClock() Clock
NewClock create a new clock with the value 1. Value 0 is considered as invalid.
func NewClockWithTime ¶
NewClockWithTime create a new clock with a value.
func (*Clock) Increment ¶
Increment is used to return the value of the lamport clock and increment it afterwards
type Persisted ¶
type Persisted struct { Clock // contains filtered or unexported fields }
func LoadPersisted ¶
LoadPersisted load a persisted Lamport clock from a file
func NewPersisted ¶
NewPersisted create a new persisted Lamport clock
func (*Persisted) Increment ¶
Increment is used to return the value of the lamport clock and increment it afterwards
Click to show internal directories.
Click to hide internal directories.