types

package
v0.0.64 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

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) SdcpbPaths added in v0.0.64

func (d DeleteEntriesList) SdcpbPaths() sdcpb.Paths

type DeleteEntry

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

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) *DeleteEntryImpl

func (*DeleteEntryImpl) SdcpbPath

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

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)
	MarkExpliciteDelete()
	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 StatType added in v0.0.63

type StatType int
const (
	StatTypeMandatory StatType = iota
	StatTypeMustStatement
	StatTypeMinMaxElementsLeaflist
	StatTypeRange
	StatTypePattern
	StatTypeLength
	StatTypeLeafRef
	StatTypeMinMaxElementsList
	StatTypeMinElements
	StatTypeEnums
)

func (StatType) String added in v0.0.63

func (s StatType) String() string

type Update

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

func NewUpdate

func NewUpdate(path *sdcpb.Path, 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) Owner

func (u *Update) Owner() string

func (*Update) Path added in v0.0.64

func (u *Update) Path() *sdcpb.Path

func (*Update) Priority

func (u *Update) Priority() int32

func (*Update) SetOwner

func (u *Update) SetOwner(owner string) *Update

func (*Update) SetPriority

func (u *Update) SetPriority(prio int32) *Update

func (*Update) String

func (u *Update) String() string

func (*Update) Timestamp

func (u *Update) Timestamp() int64

func (*Update) ToSdcpbUpdate added in v0.0.64

func (u *Update) ToSdcpbUpdate() *sdcpb.Update

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) GetExplicitDeleteFlag added in v0.0.63

func (f *UpdateInsertFlags) GetExplicitDeleteFlag() 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) SetExplicitDeleteFlag added in v0.0.63

func (f *UpdateInsertFlags) SetExplicitDeleteFlag() *UpdateInsertFlags

func (*UpdateInsertFlags) SetNewFlag

func (f *UpdateInsertFlags) SetNewFlag() *UpdateInsertFlags

func (*UpdateInsertFlags) String added in v0.0.63

func (f *UpdateInsertFlags) String() string

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) ToSdcpbPathSet added in v0.0.64

func (u UpdateSlice) ToSdcpbPathSet() *sdcpb.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

type ValidationStats added in v0.0.64

type ValidationStats struct {
	Counter map[StatType]*uint32 `json:"counters"`
}

func NewValidationStats added in v0.0.64

func NewValidationStats() *ValidationStats

func (*ValidationStats) Add added in v0.0.64

func (v *ValidationStats) Add(t StatType, i uint32)

func (*ValidationStats) GetCounter added in v0.0.64

func (v *ValidationStats) GetCounter() map[StatType]uint32

GetCounter returns a snapshot of the counters as a plain map

func (*ValidationStats) String added in v0.0.64

func (v *ValidationStats) String() string

String returns a string representation of all counters

Jump to

Keyboard shortcuts

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