Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { EventId string `json:"event_id"` EventClock EventClock `json:"event_clock"` }
Event contains value for eventClocks tree
type EventClock ¶
EventClock is vector-clock of peer-address and its individual clock
func MergeClocks ¶
func MergeClocks(v1 EventClock, v2 EventClock) *EventClock
MergeClocks merges the current event clock with the provided event clock. unique entries from both clocks are kept
type Events ¶
type Events interface { // MergeEvents merges the current event clocks with received event clocks. // New events are added to current list MergeEvents(es ...Event) // MergeEvent takes an eventId & clock and merges with existing clock // New events are added to current list MergeEvent(e Event) // GetCurrentEvents returns the events currently saved. Not in order GetCurrentEvents() []Event // GetEventsOrder returns the eventIds ordered according to vector clock for the events GetEventsOrder() (orderedEvents []Event) }
Events : provides interface for a process with lease/leader-role receives `new-events` from followers with eventId and followers vector clock
func NewEventVector ¶
func NewEventVector() Events
type VectorClock ¶
type VectorClock interface { // Get returns the current vector clock Get(eventIdOrHash string) EventClock // SendEvent returns the current vector clock after first updating self clock and then // updating the individual clocks for corresponding addresses SendEvent(eventIdOrHash string, addresses []string) EventClock // ReceiveEvent updates the current vector clock using element wise maximum with the passed vector clock ReceiveEvent(eventIdOrHash string, v EventClock) Clear(eventIdOrHash string) // contains filtered or unexported methods }
VectorClock provides interface to implement vector clock
func Copy ¶
func Copy(v VectorClock) VectorClock
func Init ¶
func Init(self string) VectorClock
Click to show internal directories.
Click to hide internal directories.