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

Method UpdateState

runtime/controller.go:649–667  ·  view source on GitHub ↗

UpdateState updates a resource's state. It can only be called from within the resource's reconciler. NOTE: Calls to UpdateState succeed even if ctx is cancelled. This enables cancelled reconcilers to update state before finishing.

(ctx context.Context, name *runtimev1.ResourceName, r *runtimev1.Resource)

Source from the content-addressed store, hash-verified

647// It can only be called from within the resource's reconciler.
648// NOTE: Calls to UpdateState succeed even if ctx is cancelled. This enables cancelled reconcilers to update state before finishing.
649func (c *Controller) UpdateState(ctx context.Context, name *runtimev1.ResourceName, r *runtimev1.Resource) error {
650 if err := c.checkRunning(); err != nil {
651 return err
652 }
653 // Must not check ctx.Err(). See NOTE above.
654 c.lock(ctx, false)
655 defer c.unlock(ctx, false)
656
657 if !c.isReconcilerForResource(ctx, name) {
658 return fmt.Errorf("can't update resource state from outside of reconciler")
659 }
660
661 err := c.catalog.updateState(name, r)
662 if err != nil {
663 return err
664 }
665
666 return nil
667}
668
669// UpdateErrorAndWarning updates a resource's error and warnings.
670// Unlike UpdateMeta and UpdateSpec, it does not cancel or enqueue reconciliation for the resource.

Callers 15

ReconcileMethod · 0.80
updateStateWithResultMethod · 0.80
updateStateClearMethod · 0.80
resolveTriggerMethod · 0.80
updateStateMethod · 0.80
ReconcileMethod · 0.80
ReconcileMethod · 0.80
updateNextRunOnMethod · 0.80
executeAllMethod · 0.80
executeSingleMethod · 0.80
popCurrentExecutionMethod · 0.80

Calls 6

checkRunningMethod · 0.95
lockMethod · 0.95
unlockMethod · 0.95
ErrorfMethod · 0.65
updateStateMethod · 0.45

Tested by

no test coverage detected