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

Method Do

pkg/controller/model/graph_client.go:123–147  ·  view source on GitHub ↗
(dag *graph.DAG, objOld, objNew client.Object, action *Action, parent *ObjectVertex, opts ...GraphOption)

Source from the content-addressed store, hash-verified

121}
122
123func (r *realGraphClient) Do(dag *graph.DAG, objOld, objNew client.Object, action *Action, parent *ObjectVertex, opts ...GraphOption) *ObjectVertex {
124 if dag.Root() == nil {
125 panic(fmt.Sprintf("root vertex not found. obj: %T, name: %s", objNew, objNew.GetName()))
126 }
127
128 graphOpts := &GraphOptions{}
129 for _, opt := range opts {
130 opt.ApplyTo(graphOpts)
131 }
132
133 vertex := &ObjectVertex{
134 OriObj: objOld,
135 Obj: objNew,
136 Action: action,
137 ClientOpt: graphOpts.clientOpt,
138 PropagationPolicy: graphOpts.propagationPolicy,
139 }
140 switch {
141 case parent == nil:
142 dag.AddConnectRoot(vertex)
143 default:
144 dag.AddConnect(parent, vertex)
145 }
146 return vertex
147}
148
149func (r *realGraphClient) IsAction(dag *graph.DAG, obj client.Object, action *Action) bool {
150 vertex := r.FindMatchedVertex(dag, obj)

Callers

nothing calls this directly

Calls 5

AddConnectRootMethod · 0.80
AddConnectMethod · 0.80
RootMethod · 0.65
GetNameMethod · 0.65
ApplyToMethod · 0.65

Tested by

no test coverage detected