hlc

package
v0.0.0-...-2ee7648 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MaxTimestamp is the max value allowed for Timestamp.
	MaxTimestamp = Timestamp{/* contains filtered or unexported fields */}
	// MinTimestamp is the min value allowed for Timestamp.
	MinTimestamp = Timestamp{/* contains filtered or unexported fields */}
)

Timestamp constant values.

Functions

This section is empty.

Types

type HLC

type HLC struct {
	sync.RWMutex
	// contains filtered or unexported fields
}
var (
	//HLC
	HLClock *HLC
)

func NewHLC

func NewHLC(pt int64) *HLC

initialize HLC with a given physical time

func (*HLC) Now

func (hlc *HLC) Now() Timestamp

func (*HLC) ReadClock

func (hlc *HLC) ReadClock() Timestamp

func (*HLC) Update

func (hlc *HLC) Update(t Timestamp) Timestamp

type Timestamp

type Timestamp struct {
	// contains filtered or unexported fields
}

func NewTimestamp

func NewTimestamp(pt int64, lc int16) *Timestamp

func NewTimestampBytes

func NewTimestampBytes(ts []byte) *Timestamp

func NewTimestampI64

func NewTimestampI64(hlc int64) *Timestamp

func NewTimestampPt

func NewTimestampPt(pt int64) *Timestamp

func (*Timestamp) Compare

func (t *Timestamp) Compare(t2 *Timestamp) int

func (Timestamp) GetLogicalTime

func (t Timestamp) GetLogicalTime() int16

func (Timestamp) GetPhysicalTime

func (t Timestamp) GetPhysicalTime() int64

func (Timestamp) GoTime

func (t Timestamp) GoTime() time.Time

GoTime converts the timestamp to a time.Time.

func (*Timestamp) IncrementLogical

func (t *Timestamp) IncrementLogical()

func (*Timestamp) ResetLogical

func (t *Timestamp) ResetLogical()

func (*Timestamp) SetLogicalTime

func (t *Timestamp) SetLogicalTime(lc int16)

func (*Timestamp) SetPhysicalTime

func (t *Timestamp) SetPhysicalTime(pt int64)

func (Timestamp) ToBytes

func (t Timestamp) ToBytes() []byte

func (Timestamp) ToInt64

func (t Timestamp) ToInt64() int64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL