Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposeTS

func ComposeTS(physical, logical int64) uint64

ComposeTS creates a ts from physical and logical parts.

func EncodeTSO

func EncodeTSO(ts int64) uint64

EncodeTSO encodes a millisecond into tso.

func ExtractPhysical

func ExtractPhysical(ts uint64) int64

ExtractPhysical returns a ts's physical part.

func GetPhysical

func GetPhysical(t time.Time) int64

GetPhysical returns physical from an instant time with millisecond precision.

func GetTimeFromTS

func GetTimeFromTS(ts uint64) time.Time

GetTimeFromTS extracts time.Time from a timestamp.

Types

type Future

type Future interface {
	Wait() (uint64, error)
}

Future is a future which promises to return a timestamp.

type Oracle

type Oracle interface {
	GetTimestamp(ctx context.Context) (uint64, error)
	GetTimestampAsync(ctx context.Context) Future
	GetLowResolutionTimestamp(ctx context.Context) (uint64, error)
	GetLowResolutionTimestampAsync(ctx context.Context) Future
	IsExpired(lockTimestamp uint64, TTL uint64) bool
	UntilExpired(lockTimeStamp uint64, TTL uint64) int64
	Close()
}

Oracle is the interface that provides strictly ascending timestamps.

Source Files

Directories

Path Synopsis
oracles