Documentation ¶
Index ¶
- Constants
- func ComposeTS(physical, logical int64) uint64
- func ExtractLogical(ts uint64) int64
- func ExtractPhysical(ts uint64) int64
- func GetPhysical(t time.Time) int64
- func GetTimeFromTS(ts uint64) time.Time
- func GoTimeToLowerLimitStartTS(now time.Time, maxTxnTimeUse int64) uint64
- func GoTimeToTS(t time.Time) uint64
- type Future
- type Option
- type Oracle
Constants ¶
View Source
const (
// GlobalTxnScope is the default transaction scope for a Oracle service.
GlobalTxnScope = "global"
)
Variables ¶
This section is empty.
Functions ¶
func ExtractLogical ¶
ExtractLogical return a ts's logical part.
func ExtractPhysical ¶
ExtractPhysical returns a ts's physical part.
func GetPhysical ¶
GetPhysical returns physical from an instant time with millisecond precision.
func GetTimeFromTS ¶
GetTimeFromTS extracts time.Time from a timestamp.
func GoTimeToLowerLimitStartTS ¶
GoTimeToLowerLimitStartTS returns the min start_ts of the uncommitted transaction. maxTxnTimeUse means the max time a Txn May use (in ms) from its begin to commit.
func GoTimeToTS ¶
GoTimeToTS converts a Go time to uint64 timestamp.
Types ¶
type Option ¶
type Option struct {
TxnScope string
}
Option represents available options for the oracle.Oracle.
type Oracle ¶
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 GetStaleTimestamp(ctx context.Context, txnScope string, prevSecond uint64) (uint64, error) IsExpired(lockTimestamp, TTL uint64, opt *Option) bool UntilExpired(lockTimeStamp, TTL uint64, opt *Option) int64 Close() GetExternalTimestamp(ctx context.Context) (uint64, error) SetExternalTimestamp(ctx context.Context, ts uint64) error }
Oracle is the interface that provides strictly ascending timestamps.
Click to show internal directories.
Click to hide internal directories.