package internal import ( "fmt" "edge-infra.dev/pkg/edge/rollouts" ) // TODO(dk185217): Only referenced in test code, perhaps move to a *_test.go file? type TestCondition struct { NodeState rollouts.NodeState Action func(*InMemStore, rollouts.NodeExecutionResult) } // TODO(dk185217): Only referenced in test code, perhaps move to a *_test.go file? type ConditionMap map[rollouts.NodeKey]TestCondition // TODO(dk185217): Only referenced in test code, perhaps move to a *_test.go file? func ModifyStore(inMemStore *InMemStore, conditions ConditionMap, result rollouts.NodeExecutionResult) error { resultKey := result.Key nodeCondition, found := conditions[resultKey] if !found { return fmt.Errorf("node key %s not found", resultKey) } if nodeCondition.NodeState == result.State { fmt.Printf("running func for %s state %s\n", resultKey, result.State) nodeCondition.Action(inMemStore, result) } else { fmt.Printf("result %s for key %s did not match desired state %s", result.State, resultKey, nodeCondition.NodeState) } return nil }