Documentation
¶
Index ¶
- Constants
- Variables
- type ActorID
- type Ticket
- func (t *Ticket) ActorID() *ActorID
- func (t *Ticket) ActorIDHex() string
- func (t *Ticket) After(other *Ticket) bool
- func (t *Ticket) AnnotatedString() string
- func (t *Ticket) Compare(other *Ticket) int
- func (t *Ticket) Delimiter() uint32
- func (t *Ticket) Key() string
- func (t *Ticket) Lamport() uint64
- func (t *Ticket) SetActorID(actorID *ActorID) *Ticket
Constants ¶
View Source
const ( // MaxLamport is the maximum value stored in lamport. MaxLamport = math.MaxUint64 // MaxDelimiter is the maximum value stored in delimiter. MaxDelimiter = math.MaxUint32 )
Variables ¶
View Source
var ( // InitialActorID represents the initial value of ActorID. InitialActorID = &ActorID{} // MaxActorID represents the maximum value of ActorID. MaxActorID = &ActorID{ math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8, } // ErrInvalidHexString is returned when the given string is not valid hex. ErrInvalidHexString = errors.New("invalid hex string") )
View Source
var ( // InitialTicket is the initial value of Ticket. InitialTicket = NewTicket( 0, 0, InitialActorID, ) // MaxTicket is the maximum value of Ticket. MaxTicket = NewTicket( MaxLamport, MaxDelimiter, MaxActorID, ) )
Functions ¶
This section is empty.
Types ¶
type ActorID ¶
type ActorID [actorIDSize]byte
ActorID is bytes represented by the hexadecimal string. It should be generated by unique value.
func ActorIDFromHex ¶
ActorIDFromHex returns the bytes represented by the hexadecimal string str.
type Ticket ¶
type Ticket struct {
// contains filtered or unexported fields
}
Ticket is a timestamp of the logical clock. Ticket is immutable. It is created by change.ID.
func (*Ticket) ActorIDHex ¶
ActorIDHex returns the actorID's hex value.
func (*Ticket) AnnotatedString ¶
AnnotatedString returns a string containing the meta data of the ticket for debugging purpose.
func (*Ticket) Compare ¶
Compare returns an integer comparing two Ticket. The result will be 0 if id==other, -1 if id < other, and +1 if id > other. If the receiver or argument is nil, it would panic at runtime.
func (*Ticket) SetActorID ¶
SetActorID creates a new instance of Ticket with the given actorID.
Click to show internal directories.
Click to hide internal directories.