Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAndRestore ¶
func ConvertAndRestore[S, D metav1.Object](src S, dst D, compare S, convert func(S, D, conversion.Scope) error, unconvert func(D, S, conversion.Scope) error, srcRestorer RestorerFor[S], dstRestorer RestorerFor[D]) error
ConvertAndRestore converts src to dst. During conversion is reads and uses any restore data in the src annotation, and writes new restore data to the dst annotation.
Types ¶
type HashedFieldRestorer ¶
type HashedFieldRestorer[T any, F any] struct { // GetField returns the field to be restored GetField func(T) *F // FilterField returns a modified copy of the field to be used for comparison. i.e. filtered fields will be ignored in comparison. FilterField func(*F) *F // RestoreField restores the field to its original pre-conversion state RestoreField func(*F, *F) }
HashedFieldRestorer restores a field to its original pre-conversion state only if it was not modified while converted. It does this by doing a full round-trip conversion before saving its state, and storing the hash of an unmodified round-trip converted object.
type RestorerFor ¶
RestorerFor holds all field restorers for a given type T.
Click to show internal directories.
Click to hide internal directories.