MCPcopy Create free account
hub / github.com/DoNewsCode/core / AddVertex

Method AddVertex

dag/dag.go:37–41  ·  view source on GitHub ↗

AddVertex adds a vertex to the dag. AddVertex is not concurrent safe. All vertexes and edges are expected to be added synchronously before calling Run.

(work func(ctx context.Context) error, option ...VertexOption)

Source from the content-addressed store, hash-verified

35// AddVertex adds a vertex to the dag. AddVertex is not concurrent safe. All
36// vertexes and edges are expected to be added synchronously before calling Run.
37func (d *DAG) AddVertex(work func(ctx context.Context) error, option ...VertexOption) VertexID {
38 id := len(d.vertexes)
39 d.vertexes = append(d.vertexes, newVertex(id, work, option...))
40 return VertexID(id)
41}
42
43// AddEdge adds an edge to the dag. AddEdge is not concurrent safe. All vertexes
44// and edges are expected to be added synchronously before calling Run.

Callers 6

ExampleDAG_runFunction · 0.80
TestDag_AddVertexFunction · 0.80
TestDag_addEdgeFunction · 0.80
TestDag_addEdgesFunction · 0.80
TestDag_RunFunction · 0.80

Calls 2

newVertexFunction · 0.85
VertexIDTypeAlias · 0.85

Tested by 6

ExampleDAG_runFunction · 0.64
TestDag_AddVertexFunction · 0.64
TestDag_addEdgeFunction · 0.64
TestDag_addEdgesFunction · 0.64
TestDag_RunFunction · 0.64