Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SkipClockUncertainityPeriodOnRestart ¶
SkipClockUncertainityPeriodOnRestart will cause the current goroutine to sleep to skip clock uncertainty period. This function must be called during the restart of the node.
The system assumes that each node keeps synchronizing with accurate NTP servers to have the clock offset limited under HLCClock.maxOffset.
Types ¶
type Clock ¶
type Clock interface { // HasNetworkLatency returns a boolean value indicating whether there is network // latency involved when retrieving timestamps. HasNetworkLatency() bool // MaxOffset returns the max offset of the physical clocks in the cluster. MaxOffset() time.Duration // Now returns the current timestamp and the upper bound of the current time // caused by clock offset. Now() (timestamp.Timestamp, timestamp.Timestamp) // Update updates the clock based on the received timestamp. Update(ts timestamp.Timestamp) // SetNodeID set node id. Just used to compatible with TAE some constraint to guaranteed // unique timestamp. SetNodeID(id uint16) }
Clock is the interface to the clock used in MatrixOne's timestamp ordering based transaction module.
type HLCClock ¶
type HLCClock struct {
// contains filtered or unexported fields
}
HLCClock is an implementation of the Hybrid Logical Clock as described in the paper titled -
Logical Physical Clocks and Consistent Snapshots in Globally Distributed Databases
func NewHLCClock ¶
NewHLCClock returns a new HLCClock instance. The maxOffset parameter specifies the max allowed clock offset. The clock readings returned by clock must be within the maxOffset bound across the entire cluster.
func NewUnixNanoHLCClock ¶
NewUnixNanoHLCClock returns a new HLCClock instance backed by the local wall clock in Unix epoch nanoseconds. Nodes' clock must be periodically synchronized, e.g. via NTP, to ensure that wall time readings are within the maxOffset offset between any two nodes.
func NewUnixNanoHLCClockWithStopper ¶ added in v0.6.0
NewUnixNanoHLCClockWithStopper is similar to NewUnixNanoHLCClock, but perform clock check use stopper
func (*HLCClock) HasNetworkLatency ¶
HasNetworkLatency returns a boolean value indicating whether there is network latency involved when retrieving timestamps. There is no such network latency in HLCClock.
func (*HLCClock) MaxOffset ¶
MaxOffset returns the max offset of the physical clocks in the cluster.