MCPcopy Create free account
hub / github.com/akash-network/node / AddFirstElements

Method AddFirstElements

util/partialord/internal/dag/dag.go:125–132  ·  view source on GitHub ↗

AddFirstElements sets the provided elements to be first in all orderings. So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A} then we are guaranteed that the total ordering will begin with {D, B, A}

(nodes ...string)

Source from the content-addressed store, hash-verified

123// So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A}
124// then we are guaranteed that the total ordering will begin with {D, B, A}
125func (dag *DAG) AddFirstElements(nodes ...string) error {
126 nodeIDs, err := dag.namesToIDs(nodes)
127 if err != nil {
128 return err
129 }
130
131 return dag.addFirst(nodeIDs)
132}
133
134func (dag *DAG) addFirst(nodes []int) error {
135 nodeMap := map[int]bool{}

Callers 2

TestAddFirstFunction · 0.95
FirstElementsMethod · 0.80

Calls 2

namesToIDsMethod · 0.95
addFirstMethod · 0.95

Tested by 1

TestAddFirstFunction · 0.76