tidb: github.com/pingcap/tidb/store/tikv/oracle Index | Files | Directories

package oracle

import "github.com/pingcap/tidb/store/tikv/oracle"

Index

Package Files

oracle.go

Constants

const (

    // GlobalTxnScope is the default transaction scope for a Oracle service.
    GlobalTxnScope = "global"
)

func ComposeTS Uses

func ComposeTS(physical, logical int64) uint64

ComposeTS creates a ts from physical and logical parts.

func EncodeTSO Uses

func EncodeTSO(ts int64) uint64

EncodeTSO encodes a millisecond into tso.

func ExtractPhysical Uses

func ExtractPhysical(ts uint64) int64

ExtractPhysical returns a ts's physical part.

func GetPhysical Uses

func GetPhysical(t time.Time) int64

GetPhysical returns physical from an instant time with millisecond precision.

func GetTimeFromTS Uses

func GetTimeFromTS(ts uint64) time.Time

GetTimeFromTS extracts time.Time from a timestamp.

type Future Uses

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

Future is a future which promises to return a timestamp.

type Option Uses

type Option struct {
    TxnScope string
}

Option represents available options for the oracle.Oracle.

type Oracle Uses

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

Oracle is the interface that provides strictly ascending timestamps.

Directories

PathSynopsis
oracles

Package oracle imports 5 packages (graph) and is imported by 262 packages. Updated 2020-11-24. Refresh now. Tools for package owners.