func()

in internal/resource/tree.go [119:140]


func (t *tree) UpdateState(comp *apiv1.Composition, ref ManifestRef, state *apiv1.ResourceState, enqueue func(Ref)) {
	idx, ok := t.byManiRef[ref]
	if !ok {
		return
	}

	// Requeue self when the state has changed
	lastKnown := idx.Resource.latestKnownState.Swap(state)
	if (!idx.Seen && lastKnown == nil) || !lastKnown.Equal(state) || (!idx.CompositionDeleting && comp.DeletionTimestamp != nil) {
		enqueue(idx.Resource.Ref)
	}
	idx.Seen = true
	idx.CompositionDeleting = comp.DeletionTimestamp != nil

	// Dependents should no longer be blocked by this resource
	if state.Ready != nil && (lastKnown == nil || lastKnown.Ready == nil) {
		for _, dep := range idx.Dependents {
			delete(dep.PendingDependencies, idx.Resource.Ref)
			enqueue(dep.Resource.Ref)
		}
	}
}