hybrid_logical_clock

package
v1.21.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a Clock, b Clock) int

Compare 2 clocks, returns 0 if a == b, -1 if a > b, 1 if a < b

func Equal

func Equal(a Clock, b Clock) bool

Equal returns whether two clocks are equal

func Greater

func Greater(a Clock, b Clock) bool

Greater returns true if a is greater than b

func Less

func Less(a Clock, b Clock) bool

Greater returns true if a is greater than b

func UTC

func UTC(c Clock) time.Time

UTC returns UTC time of a clock in millisecond resolution.

Types

type Clock

func Max

func Max(a Clock, b Clock) Clock

Max returns the maximum of two clocks

func Min added in v1.21.1

func Min(a Clock, b Clock) Clock

Min returns the minimum of two clocks

func Next

func Next(clock Clock, source commonclock.TimeSource) Clock

Next generates the next clock timestamp given the current clock. HybridLogicalClock requires the previous clock to ensure that time doesn't move backwards and the next clock is monotonically increasing.

func Ptr

func Ptr(c Clock) *Clock

Ptr returns a pointer to a clock (to ease inlining the APIs in this package).

func Zero

func Zero(clusterID int64) Clock

Zero generates a zeroed logical clock for the cluster ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL