MCPcopy Create free account
hub / github.com/rilldata/rill / updateSpec

Method updateSpec

runtime/catalog_cache.go:318–335  ·  view source on GitHub ↗

updateSpec updates the spec field of a resource. It uses the spec from the passed resource and disregards its other fields.

(name *runtimev1.ResourceName, from *runtimev1.Resource)

Source from the content-addressed store, hash-verified

316// updateSpec updates the spec field of a resource.
317// It uses the spec from the passed resource and disregards its other fields.
318func (c *catalogCache) updateSpec(name *runtimev1.ResourceName, from *runtimev1.Resource) error {
319 r, err := c.get(name, false, true)
320 if err != nil {
321 return err
322 }
323 c.unlink(r)
324 err = c.ctrl.reconciler(name.Kind).AssignSpec(from, r)
325 if err != nil {
326 return err
327 }
328 r.Meta.Version++
329 r.Meta.SpecVersion++
330 r.Meta.SpecUpdatedOn = timestamppb.Now()
331 c.link(r)
332 c.dirty[nameStr(r.Meta.Name)] = r.Meta.Name
333 c.addEvent(r.Meta.Name, r, runtimev1.ResourceEvent_RESOURCE_EVENT_WRITE)
334 return nil
335}
336
337// updateState updates the state field of a resource.
338// It uses the state from the passed resource and disregards its other fields.

Callers 1

UpdateSpecMethod · 0.80

Calls 7

getMethod · 0.95
unlinkMethod · 0.95
linkMethod · 0.95
addEventMethod · 0.95
nameStrFunction · 0.85
reconcilerMethod · 0.80
AssignSpecMethod · 0.65

Tested by

no test coverage detected