Documentation ¶
Index ¶
- func GetIndicesID(ev []*Event, n int) [][]int
- type Event
- type EventInfo
- type EventPointer
- type Graph
- func (g *Graph) AddEvent(ev EventInfo, checkOnly bool) (event *Event, err error)
- func (g *Graph) AddEvents(events []EventInfo) (added []*Event, remainder, invalid []EventInfo)
- func (g *Graph) CheckGCIndex(index IndexType, gcFunc func(*Event) bool)
- func (g *Graph) ComputeDiffID(id IndexType) (ret []*Event)
- func (g *Graph) ComputeDiffIDIndex(id IndexType) (ret []IndexType)
- func (g *Graph) ContainsEventPointer(ev EventPointer) bool
- func (g *Graph) CreateEvent(localID, remoteID IndexType, buff []byte, checkOnly bool) *Event
- func (g *Graph) CreateEventIndex(localID IndexType, buff []byte, checkOnly bool) *Event
- func (g *Graph) GetDecision(round IndexType) (hasDecided bool, decision [][][]byte, decisionRounds []IndexType, ...)
- func (g *Graph) GetDecisionEvents(r IndexType) (ret []*Event, err error)
- func (g *Graph) GetIndices() []IndexType
- func (g *Graph) GetLargerIndexCount(localID IndexType) (count int)
- func (g *Graph) GetMissingDependencies(ev EventInfo) (ret []EventPointer)
- func (g *Graph) GetMissingEvents(ev *Event, indices []IndexType) (maxIdxs []IndexType, ret []*Event)
- func (g *Graph) GetMoreRecent(indices []IndexType) (ret []*Event, gcIdxs []IndexType, err error)
- func (g *Graph) GetWitnesses(idx IndexType) [][]*Event
- type IndexType
- type SortEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetIndicesID ¶
GetIndicesID returns the indices of the events per id
Types ¶
type Event ¶
type EventInfo ¶
type EventInfo struct { LocalInfo EventPointer // Local id and index, plus hash of local ancestor RemoteAncestors []EventPointer // Remote ancestors Buff []byte // proposal }
type EventPointer ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
func (*Graph) AddEvent ¶
AddEvent adds the Event to the Graph and returns an error if the Event in invalid. It returns the Event added.
func (*Graph) AddEvents ¶
AddEvents adds a set of events to the Graph. added are the events that we successfully added remainder are the ones that were not able to be added because their ancestors have not yet been added. invalid are those that created errors when adding.
func (*Graph) CheckGCIndex ¶
CheckGCIndex will check for garbage collection of events happening at index index and before.
func (*Graph) ComputeDiffID ¶
ComputeDiffID returns the events to which there is no path from the most recent Event of ID from. (this is used to send values to a different node when creating a new Event)
func (*Graph) ComputeDiffIDIndex ¶
ComputeDiffID returns the index of the events to which there is no path from the most recent Event of ID from. (this is used to send values to a different node when creating a new Event)
func (*Graph) ContainsEventPointer ¶
func (g *Graph) ContainsEventPointer(ev EventPointer) bool
containsEventPointer returns true if the event pointer is contained in the graph
func (*Graph) CreateEvent ¶
CreateEvent creates a new Event from the local node ID to the remote node ID with the Buff as its proposal
func (*Graph) CreateEventIndex ¶
CreateEventIndex creates an event at localID. All other ids that have the same index as (or larger than) the current localID index will be added as remote dependencies.
func (*Graph) GetDecision ¶
func (g *Graph) GetDecision(round IndexType) (hasDecided bool, decision [][][]byte, decisionRounds []IndexType, decisionIndex []IndexType, decCount int, decisionBools []bool)
GetDecision returns true if the round has decided. It returns the set of n decided values (a voted no decision will have a nil value), and the rounds that caused each of the n events to decide. decCount is the number of nodes that decided yes for the index.
func (*Graph) GetDecisionEvents ¶
GetDecisionEvents returns the set of events that caused round r to decide that follow those that caused round r+1 to decide. If called on a round not yet decided it returns the events after the most recent decision.
func (*Graph) GetIndices ¶
GetIndices returns the current indices of each node id.
func (*Graph) GetLargerIndexCount ¶
GetLarger index count returns the number of IDs that have events with index as large or larger than the index of the event at ID localID (including the event at localID).
func (*Graph) GetMissingDependencies ¶
func (g *Graph) GetMissingDependencies(ev EventInfo) (ret []EventPointer)
getMissingDependencies returns the ancestors that of ev that are not in the graph.
func (*Graph) GetMissingEvents ¶
func (g *Graph) GetMissingEvents(ev *Event, indices []IndexType) (maxIdxs []IndexType, ret []*Event)
GetMissingEvents returns the events that are needed by ev, but not contained in indices, maxIds is the maximum id of the indices at each index.
func (*Graph) GetMoreRecent ¶
GetMoreRecent takes a list of indices, one per node id and returns the events that follow. If any indices have been garbage collected and have events that are needed then the indices are returned as part of gcIdxs.
func (*Graph) GetWitnesses ¶
GetWitnesses returns the set of witnesses for the given index.
type IndexType ¶
type IndexType int32
func GetIndices ¶
GetIndices returns the indices of the events.
func MaxIndices ¶
MaxIndices returns the max at each index of the inputs.