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

Method doWrite

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

Source from the content-addressed store, hash-verified

207}
208
209func (r *realGraphClient) doWrite(dag *graph.DAG, objOld, objNew client.Object, action *Action, opts ...GraphOption) {
210 graphOpts := &GraphOptions{}
211 for _, opt := range opts {
212 opt.ApplyTo(graphOpts)
213 }
214
215 vertex := r.FindMatchedVertex(dag, objNew)
216 switch {
217 case vertex != nil:
218 objVertex, _ := vertex.(*ObjectVertex)
219 objVertex.Action = action
220 if graphOpts.replaceIfExisting {
221 objVertex.Obj = objNew
222 objVertex.OriObj = objOld
223 }
224 default:
225 vertex = &ObjectVertex{
226 Obj: objNew,
227 OriObj: objOld,
228 Action: action,
229 ClientOpt: graphOpts.clientOpt,
230 }
231 dag.AddConnectRoot(vertex)
232 }
233}
234
235func (r *realGraphClient) FindMatchedVertex(dag *graph.DAG, object client.Object) graph.Vertex {
236 keyLookFor, err := GetGVKName(object)

Callers 5

CreateMethod · 0.95
UpdateMethod · 0.95
PatchMethod · 0.95
DeleteMethod · 0.95
StatusMethod · 0.95

Calls 3

FindMatchedVertexMethod · 0.95
AddConnectRootMethod · 0.80
ApplyToMethod · 0.65

Tested by

no test coverage detected