MCPcopy
hub / github.com/apecloud/kubeblocks / Connect

Method Connect

pkg/controller/graph/dag.go:116–128  ·  view source on GitHub ↗

Connect vertex 'from' to 'to' by a new edge if not exist

(from, to Vertex)

Source from the content-addressed store, hash-verified

114
115// Connect vertex 'from' to 'to' by a new edge if not exist
116func (d *DAG) Connect(from, to Vertex) bool {
117 if from == nil || to == nil {
118 return false
119 }
120 for k := range d.edges {
121 if k.From() == from && k.To() == to {
122 return true
123 }
124 }
125 edge := RealEdge(from, to)
126 d.edges[edge] = edge
127 return true
128}
129
130// AddConnect add 'to' to the DAG 'd' and connect 'from' to 'to'
131func (d *DAG) AddConnect(from, to Vertex) bool {

Callers 11

newReconcilerTreeFunction · 0.95
AddConnectMethod · 0.95
TestRemoveVertexFunction · 0.95
TestXConnectFunction · 0.95
TestValidateFunction · 0.95
TestEqualsFunction · 0.95
TestMergeFunction · 0.95
newTestDAGFunction · 0.95
RootMethod · 0.80
DependOnMethod · 0.80

Calls 3

RealEdgeFunction · 0.85
FromMethod · 0.65
ToMethod · 0.65

Tested by 6

TestRemoveVertexFunction · 0.76
TestXConnectFunction · 0.76
TestValidateFunction · 0.76
TestEqualsFunction · 0.76
TestMergeFunction · 0.76
newTestDAGFunction · 0.76