engine: Create a resource kind+name specific stateful store

This adds a meta state store that is preserved between graph switches if
the kind and name match. This is useful so that rapid graph changes
don't necessarily reset their retry count if they've only changed one
resource field.
This commit is contained in:
James Shubin
2023-09-01 20:45:12 -04:00
parent 07bd8afc4a
commit 9545e409d4
7 changed files with 106 additions and 1 deletions

View File

@@ -220,6 +220,16 @@ func Stringer(res Res) string {
return Repr(res.Kind(), res.Name())
}
// ResPtrUID is a unique identifier that is consistent for the kind and name of
// the resource only.
type ResPtrUID string
// PtrUID generates a ResPtrUID from a resource.
func PtrUID(res Res) ResPtrUID {
// the use of "repr" is kind of arbitrary as long as it's unique
return ResPtrUID(Repr(res.Kind(), res.Name()))
}
// Validate validates a resource by checking multiple aspects. This is the main
// entry point for running all the validation steps on a resource.
func Validate(res Res) error {