types

package
v0.0.58 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	KeysIndexSep = "_"
)

Variables

This section is empty.

Functions

func ApplyCacheUpdateFilters

func ApplyCacheUpdateFilters(u *Update, fs []CacheUpdateFilter) bool

ApplyCacheUpdateFilters takes a bunch of CacheUpdateFilters applies them in an AND fashion and returns the result.

func CacheUpdateFilterExcludeOwner

func CacheUpdateFilterExcludeOwner(owner string) func(u *Update) bool

func Map

func Map[T any](u UpdateSlice, f func(*Update) T) []T

Types

type CacheUpdateFilter

type CacheUpdateFilter func(u *Update) bool

type DeleteEntriesList

type DeleteEntriesList []DeleteEntry

func (DeleteEntriesList) PathSlices

func (d DeleteEntriesList) PathSlices() PathSlices

type DeleteEntry

type DeleteEntry interface {
	SdcpbPath() (*sdcpb.Path, error)
	Path() PathSlice
}

type DeleteEntryImpl

type DeleteEntryImpl struct {
	// contains filtered or unexported fields
}

DeleteEntryImpl is a crutch to flag oldbestcases if on a choice, the active case changed

func NewDeleteEntryImpl

func NewDeleteEntryImpl(sdcpbPath *sdcpb.Path, pathslice PathSlice) *DeleteEntryImpl

func (*DeleteEntryImpl) Path

func (d *DeleteEntryImpl) Path() PathSlice

func (*DeleteEntryImpl) SdcpbPath

func (d *DeleteEntryImpl) SdcpbPath() (*sdcpb.Path, error)

type DeviationEntry

type DeviationEntry struct {
	// contains filtered or unexported fields
}

func NewDeviationEntry

func NewDeviationEntry(intentName string, reason DeviationReason, path *sdcpb.Path) *DeviationEntry

func (*DeviationEntry) CurrentValue

func (d *DeviationEntry) CurrentValue() *sdcpb.TypedValue

func (*DeviationEntry) ExpectedValue

func (d *DeviationEntry) ExpectedValue() *sdcpb.TypedValue

func (*DeviationEntry) IntentName

func (d *DeviationEntry) IntentName() string

func (*DeviationEntry) Path

func (d *DeviationEntry) Path() *sdcpb.Path

func (*DeviationEntry) Reason

func (d *DeviationEntry) Reason() DeviationReason

func (*DeviationEntry) SetCurrentValue

func (d *DeviationEntry) SetCurrentValue(cv *sdcpb.TypedValue) *DeviationEntry

func (*DeviationEntry) SetExpectedValue

func (d *DeviationEntry) SetExpectedValue(ev *sdcpb.TypedValue) *DeviationEntry

func (*DeviationEntry) String added in v0.0.58

func (d *DeviationEntry) String() string

type DeviationReason

type DeviationReason int
const (
	DeviationReasonUndefined DeviationReason = iota
	DeviationReasonUnhandled
	DeviationReasonNotApplied
	DeviationReasonOverruled
	DeviationReasonIntentExists
)

type LeafEntry

type LeafEntry interface {
	MarkDelete(onlyIntended bool)
	MarkNew()
}

type LrefPath added in v0.0.58

type LrefPath []*LrefPathElem

LrefPath for the leafref resolution we need to distinguish between already resolved values and not yet resolved xpath statements this is a struct that provides this information

func NewLrefPath added in v0.0.58

func NewLrefPath(p *sdcpb.Path) LrefPath

func (LrefPath) ToSdcpbPathElem added in v0.0.58

func (pes LrefPath) ToSdcpbPathElem() []*sdcpb.PathElem

type LrefPathElem added in v0.0.58

type LrefPathElem struct {
	Name string
	Keys map[string]*LrefPathElemKeyValue
}

func (*LrefPathElem) KeysToMap added in v0.0.58

func (l *LrefPathElem) KeysToMap() map[string]string

type LrefPathElemKeyValue added in v0.0.58

type LrefPathElemKeyValue struct {
	DoNotResolve bool
	Value        string
}

type PathSet

type PathSet struct {
	// contains filtered or unexported fields
}

func NewPathSet

func NewPathSet() *PathSet

func (*PathSet) AddPath

func (p *PathSet) AddPath(path []string)

func (*PathSet) GetPaths

func (p *PathSet) GetPaths() PathSlices

func (*PathSet) Join

func (p *PathSet) Join(other *PathSet)

type PathSlice

type PathSlice []string

PathSlice is a single Path represented as a string slice

func (PathSlice) DeepCopy

func (p PathSlice) DeepCopy() PathSlice

func (PathSlice) String

func (p PathSlice) String() string

type PathSlices

type PathSlices []PathSlice

PathSlices is the slice collection of multiple PathSlice objects.

func (PathSlices) StringSlice

func (p PathSlices) StringSlice() []string

func (PathSlices) ToStringSlice

func (p PathSlices) ToStringSlice() [][]string

type Update

type Update struct {
	// contains filtered or unexported fields
}

func NewUpdate

func NewUpdate(path PathSlice, val *sdcpb.TypedValue, prio int32, intent string, ts int64) *Update

func NewUpdateFromSdcpbUpdate

func NewUpdateFromSdcpbUpdate(u *sdcpb.Update, prio int32, intent string, ts int64) *Update

func (*Update) DeepCopy

func (u *Update) DeepCopy() *Update

func (*Update) Equal

func (u *Update) Equal(other *Update) bool

EqualSkipPath checks the equality of two updates. It however skips comparing paths and timestamps. This is a shortcut for performace, for cases in which it is already clear that the path is definately equal.

func (*Update) GetPathSlice

func (u *Update) GetPathSlice() PathSlice

func (*Update) Owner

func (u *Update) Owner() string

func (*Update) Priority

func (u *Update) Priority() int32

func (*Update) SetOwner

func (u *Update) SetOwner(owner string)

func (*Update) SetPriority

func (u *Update) SetPriority(prio int32)

func (*Update) String

func (u *Update) String() string

func (*Update) Timestamp

func (u *Update) Timestamp() int64

func (*Update) Value

func (u *Update) Value() *sdcpb.TypedValue

func (*Update) ValueAsBytes

func (u *Update) ValueAsBytes() ([]byte, error)

type UpdateInsertFlags

type UpdateInsertFlags struct {
	// contains filtered or unexported fields
}

func NewUpdateInsertFlags

func NewUpdateInsertFlags() *UpdateInsertFlags

NewUpdateInsertFlags returns a new *UpdateInsertFlags instance with all values set to false, so not new, and not marked for deletion

func (*UpdateInsertFlags) Apply

func (*UpdateInsertFlags) GetDeleteFlag

func (f *UpdateInsertFlags) GetDeleteFlag() bool

func (*UpdateInsertFlags) GetDeleteOnlyIntendedFlag

func (f *UpdateInsertFlags) GetDeleteOnlyIntendedFlag() bool

func (*UpdateInsertFlags) GetNewFlag

func (f *UpdateInsertFlags) GetNewFlag() bool

func (*UpdateInsertFlags) SetDeleteFlag

func (f *UpdateInsertFlags) SetDeleteFlag() *UpdateInsertFlags

func (*UpdateInsertFlags) SetDeleteOnlyUpdatedFlag

func (f *UpdateInsertFlags) SetDeleteOnlyUpdatedFlag() *UpdateInsertFlags

func (*UpdateInsertFlags) SetNewFlag

func (f *UpdateInsertFlags) SetNewFlag() *UpdateInsertFlags

type UpdateSlice

type UpdateSlice []*Update

UpdateSlice A slice of *Update, that defines additional helper functions.

func ExpandAndConvertIntent

func ExpandAndConvertIntent(ctx context.Context, scb utils.SchemaClientBound, intentName string, priority int32, upds []*sdcpb.Update, ts int64) (UpdateSlice, error)

ExpandAndConvertIntent takes a slice of Updates ([]*sdcpb.Update) and converts it into a tree.UpdateSlice, that contains *treetypes.Updates.

func (UpdateSlice) CopyWithNewOwnerAndPrio

func (u UpdateSlice) CopyWithNewOwnerAndPrio(owner string, prio int32) UpdateSlice

func (UpdateSlice) DeepCopy

func (u UpdateSlice) DeepCopy() UpdateSlice

func (UpdateSlice) GetFirstPriorityValue

func (u UpdateSlice) GetFirstPriorityValue() int32

GetFirstPriorityValue returns the priority of the first element or math.MaxInt32 if len() is zero

func (UpdateSlice) GetLowestPriorityValue

func (u UpdateSlice) GetLowestPriorityValue(filters []CacheUpdateFilter) int32

GetHighesPriorityValue returns the highes priority value of all the containing Updates

func (UpdateSlice) String

func (u UpdateSlice) String() string

func (UpdateSlice) ToPathSet

func (u UpdateSlice) ToPathSet() *PathSet

type ValidationResultEntry

type ValidationResultEntry struct {
	// contains filtered or unexported fields
}

func NewValidationResultEntry

func NewValidationResultEntry(intentName string, message error, typ ValidationResultEntryType) *ValidationResultEntry

func (*ValidationResultEntry) String added in v0.0.58

func (v *ValidationResultEntry) String() string

type ValidationResultEntryType

type ValidationResultEntryType int8
const (
	ValidationResultEntryTypeError ValidationResultEntryType = iota
	ValidationResultEntryTypeWarning
)

func (ValidationResultEntryType) String added in v0.0.58

func (v ValidationResultEntryType) String() string

type ValidationResultIntent

type ValidationResultIntent struct {
	// contains filtered or unexported fields
}

func NewValidationResultIntent

func NewValidationResultIntent(intentName string) *ValidationResultIntent

func (*ValidationResultIntent) AddEntry

func (*ValidationResultIntent) AddError

func (v *ValidationResultIntent) AddError(err error)

func (*ValidationResultIntent) AddWarning

func (v *ValidationResultIntent) AddWarning(warn error)

func (*ValidationResultIntent) Errors

func (v *ValidationResultIntent) Errors() []error

func (*ValidationResultIntent) ErrorsString

func (v *ValidationResultIntent) ErrorsString() []string

func (*ValidationResultIntent) String

func (v *ValidationResultIntent) String() string

func (*ValidationResultIntent) Warnings

func (v *ValidationResultIntent) Warnings() []error

func (*ValidationResultIntent) WarningsString

func (v *ValidationResultIntent) WarningsString() []string

type ValidationResults

type ValidationResults map[string]*ValidationResultIntent

ValidationResults is map[string]*ValidationResultIntent so consider iterating via range

func (ValidationResults) AddEntry

func (ValidationResults) AddIntent

func (v ValidationResults) AddIntent(intentName string)

func (ValidationResults) ErrorsStr

func (v ValidationResults) ErrorsStr() []string

func (ValidationResults) HasErrors

func (v ValidationResults) HasErrors() bool

func (ValidationResults) HasWarnings

func (v ValidationResults) HasWarnings() bool

func (ValidationResults) JoinErrors

func (v ValidationResults) JoinErrors() error

func (ValidationResults) JoinWarnings

func (v ValidationResults) JoinWarnings() error

func (ValidationResults) String

func (v ValidationResults) String() string

func (ValidationResults) WarningsStr

func (v ValidationResults) WarningsStr() []string

Jump to

Keyboard shortcuts

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