hybrid_logical_clock

package
v1.24.0-m3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 4 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 ProtoTimestamp added in v1.24.0

func ProtoTimestamp(c *Clock) *timestamppb.Timestamp

ProtoTimestamp returns timestamppb.New(UTC(c))

func Since added in v1.22.1

func Since(c *Clock) time.Duration

Since returns time.Since(UTC(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.

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(prior *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 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