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

Method updateState

runtime/catalog_cache.go:339–356  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

337// updateState updates the state field of a resource.
338// It uses the state from the passed resource and disregards its other fields.
339func (c *catalogCache) updateState(name *runtimev1.ResourceName, from *runtimev1.Resource) error {
340 r, err := c.get(name, true, true)
341 if err != nil {
342 return err
343 }
344 c.unlink(r)
345 err = c.ctrl.reconciler(name.Kind).AssignState(from, r)
346 if err != nil {
347 return err
348 }
349 r.Meta.Version++
350 r.Meta.StateVersion++
351 r.Meta.StateUpdatedOn = timestamppb.Now()
352 c.link(r)
353 c.dirty[nameStr(r.Meta.Name)] = r.Meta.Name
354 c.addEvent(r.Meta.Name, r, runtimev1.ResourceEvent_RESOURCE_EVENT_WRITE)
355 return nil
356}
357
358// updateErrorAndWarning updates both reconcile_error and reconcile_warnings of a resource.
359func (c *catalogCache) updateErrorAndWarning(name *runtimev1.ResourceName, reconcileErr error, warnings []string) error {

Callers 1

UpdateStateMethod · 0.45

Calls 7

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

Tested by

no test coverage detected