merge

package
v0.0.0-...-d88c8b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conflict

type Conflict struct {
	Manager string
	Path    fieldpath.Path
}

Conflict is a conflict on a specific field with the current manager of that field. It does implement the error interface so that it can be used as an error.

func (Conflict) Equals

func (c Conflict) Equals(c2 Conflict) bool

Equals returns true if c == c2

func (Conflict) Error

func (c Conflict) Error() string

Error formats the conflict as an error.

type Conflicts

type Conflicts []Conflict

Conflicts accumulates multiple conflicts and aggregates them by managers.

func ConflictsFromManagers

func ConflictsFromManagers(sets fieldpath.ManagedFields) Conflicts

ConflictsFromManagers creates a list of conflicts given Managers sets.

func (Conflicts) Equals

func (c Conflicts) Equals(c2 Conflicts) bool

Equals returns true if the lists of conflicts are the same.

func (Conflicts) Error

func (conflicts Conflicts) Error() string

Error prints the list of conflicts, grouped by sorted managers.

func (Conflicts) ToSet

func (c Conflicts) ToSet() *fieldpath.Set

ToSet aggregates conflicts for all managers into a single Set.

type Converter

type Converter interface {
	Convert(object *typed.TypedValue, version fieldpath.APIVersion) (*typed.TypedValue, error)
	IsMissingVersionError(error) bool
}

Converter is an interface to the conversion logic. The converter needs to be able to convert objects from one version to another.

type Updater

type Updater struct {
	Converter     Converter
	IgnoredFields map[fieldpath.APIVersion]*fieldpath.Set
	// contains filtered or unexported fields
}

Updater is the object used to compute updated FieldSets and also merge the object on Apply.

func (*Updater) Apply

func (s *Updater) Apply(liveObject, configObject *typed.TypedValue, version fieldpath.APIVersion, managers fieldpath.ManagedFields, manager string, force bool) (*typed.TypedValue, fieldpath.ManagedFields, error)

Apply should be called when Apply is run, given the current object as well as the configuration that is applied. This will merge the object and return it. If the object hasn't changed, nil is returned (the managers can still have changed though).

func (*Updater) EnableUnionFeature

func (s *Updater) EnableUnionFeature()

EnableUnionFeature turns on union handling. It is disabled by default until the feature is complete.

func (*Updater) Update

func (s *Updater) Update(liveObject, newObject *typed.TypedValue, version fieldpath.APIVersion, managers fieldpath.ManagedFields, manager string) (*typed.TypedValue, fieldpath.ManagedFields, error)

Update is the method you should call once you've merged your final object on CREATE/UPDATE/PATCH verbs. newObject must be the object that you intend to persist (after applying the patch if this is for a PATCH call), and liveObject must be the original object (empty if this is a CREATE call).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL