timestamp

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTimestamp        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTimestamp          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTimestamp = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type Timestamp

type Timestamp struct {
	// PhysicalTime is the physical component of the HLC, it is read from a node's
	// wall clock time as Unix epoch time in nanoseconds. HLC requires this field
	// to be monotonically increase on each node.
	PhysicalTime int64 `protobuf:"varint,1,opt,name=PhysicalTime,proto3" json:"PhysicalTime,omitempty"`
	// LogicalTime is the logical component of the HLC, its value is maintained
	// according to the HLC algorithm. The HLC paper further establishes that its
	// value will not overflow in a real production environment.
	LogicalTime uint32 `protobuf:"varint,2,opt,name=LogicalTime,proto3" json:"LogicalTime,omitempty"`
	// NodeID just used to compatible with TAE some constraint to guaranteed unique
	// timestamp. uint16 is not defined, so use uint32, but only 2 bytes. The field
	// is not used for comparing the timestamps.
	NodeID               uint32   `protobuf:"varint,3,opt,name=NodeID,proto3" json:"NodeID,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Timestamp is a HLC time value. All its field should never be accessed directly by its users.

func ParseTimestamp added in v0.7.0

func ParseTimestamp(value string) (Timestamp, error)

ParseTimestamp parse timestamp from debug string

func (Timestamp) DebugString added in v0.6.0

func (m Timestamp) DebugString() string

DebugString returns debug string

func (*Timestamp) Descriptor

func (*Timestamp) Descriptor() ([]byte, []int)

func (Timestamp) Equal

func (m Timestamp) Equal(rhs Timestamp) bool

Equal returns a boolean value indicating whether the lhs timestamp equals to the rhs timestamp.

func (*Timestamp) GetLogicalTime

func (m *Timestamp) GetLogicalTime() uint32

func (*Timestamp) GetNodeID added in v0.6.0

func (m *Timestamp) GetNodeID() uint32

func (*Timestamp) GetPhysicalTime

func (m *Timestamp) GetPhysicalTime() int64

func (Timestamp) Greater

func (m Timestamp) Greater(rhs Timestamp) bool

Greater returns a boolean value indicating whether the lhs timestamp is greater than the rhs timestamp value.

func (Timestamp) GreaterEq

func (m Timestamp) GreaterEq(rhs Timestamp) bool

GreaterEq returns a boolean value indicating whether the lhs timestamp is greater than or equal to the rhs timestamp value.

func (Timestamp) IsEmpty

func (m Timestamp) IsEmpty() bool

IsEmpty returns a boolean value indicating whether the current timestamp is an empty value.

func (Timestamp) Less

func (m Timestamp) Less(rhs Timestamp) bool

Less returns a boolean value indicating whether the lhs timestamp is less than the rhs timestamp value.

func (Timestamp) LessEq

func (m Timestamp) LessEq(rhs Timestamp) bool

LessEq returns a boolean value indicating whether the lhs timestamp is less than or equal to the rhs timestamp value.

func (*Timestamp) Marshal

func (m *Timestamp) Marshal() (dAtA []byte, err error)

func (*Timestamp) MarshalTo

func (m *Timestamp) MarshalTo(dAtA []byte) (int, error)

func (*Timestamp) MarshalToSizedBuffer

func (m *Timestamp) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (Timestamp) Next

func (m Timestamp) Next() Timestamp

Next returns the smallest timestamp that is greater than the current timestamp.

func (Timestamp) Prev

func (m Timestamp) Prev() Timestamp

Prev returns the smallest timestamp that is less than the current timestamp.

func (*Timestamp) ProtoMessage

func (*Timestamp) ProtoMessage()

func (Timestamp) ProtoSize added in v0.6.0

func (m Timestamp) ProtoSize() int

func (*Timestamp) Reset

func (m *Timestamp) Reset()

func (*Timestamp) Size

func (m *Timestamp) Size() (n int)

func (*Timestamp) String

func (m *Timestamp) String() string

func (Timestamp) ToStdTime

func (m Timestamp) ToStdTime() time.Time

ToStdTime converts the HLC timestamp to a regular golang stdlib UTC timestamp. The logical time component of the HLC is lost after the conversion.

func (*Timestamp) Unmarshal

func (m *Timestamp) Unmarshal(dAtA []byte) error

func (*Timestamp) XXX_DiscardUnknown

func (m *Timestamp) XXX_DiscardUnknown()

func (*Timestamp) XXX_Marshal

func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Timestamp) XXX_Merge

func (m *Timestamp) XXX_Merge(src proto.Message)

func (*Timestamp) XXX_Size

func (m *Timestamp) XXX_Size() int

func (*Timestamp) XXX_Unmarshal

func (m *Timestamp) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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