hybrid_logical_clock

package
v1.23.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 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 Since added in v1.22.1

func Since(c Clock) time.Duration

Since returns time.Since(UTC(c))

func SincePtr added in v1.22.1

func SincePtr(c *Clock) time.Duration

SincePtr returns time.Since(UTCFromPtr(c))

func UTC

func UTC(c Clock) time.Time

UTC returns a Time from a Clock in millisecond resolution. The Time's Location is set to UTC.

func UTCPtr added in v1.22.1

func UTCPtr(c *Clock) time.Time

UTC returns a Time from a *Clock in millisecond resolution. The Time's Location is set to UTC. If the argument is nil, it returns the Unix epoch.

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