Documentation ¶
Index ¶
- Constants
- func ApplyCacheUpdateFilters(u *cache.Update, fs []CacheUpdateFilter) bool
- func CacheUpdateFilterExcludeOwner(owner string) func(u *cache.Update) bool
- func FilterDeleted(l *LeafEntry) bool
- func FilterNew(l *LeafEntry) bool
- func FilterNonDeleted(l *LeafEntry) bool
- func FilterNonDeletedButNewOrUpdated(l *LeafEntry) bool
- func FilterUpdated(l *LeafEntry) bool
- func LeafEntriesToCacheUpdates(l []*LeafEntry) []*cache.Update
- func Map[T any](u UpdateSlice, f func(*cache.Update) T) []T
- func Unfiltered(l *LeafEntry) bool
- type CacheUpdateFilter
- type DeleteEntry
- type DeleteEntryImpl
- type Entry
- type EntryImpl
- func (s EntryImpl) AddCacheUpdateRecursive(ctx context.Context, c *cache.Update, new bool) (Entry, error)
- func (s EntryImpl) FilterChilds(keys map[string]string) ([]Entry, error)
- func (s EntryImpl) FinishInsertionPhase()
- func (s EntryImpl) GetByOwner(owner string, result []*LeafEntry) []*LeafEntry
- func (s EntryImpl) GetDeletes(deletes []DeleteEntry, aggregatePaths bool) ([]DeleteEntry, error)
- func (s EntryImpl) GetFirstAncestorWithSchema() (Entry, int)
- func (s EntryImpl) GetHighestPrecedence(result LeafVariantSlice, onlyNewOrUpdated bool) LeafVariantSlice
- func (s EntryImpl) GetLevel() int
- func (s EntryImpl) GetParent() Entry
- func (s EntryImpl) GetRoot() Entry
- func (s EntryImpl) GetRootBasedEntryChain() []Entry
- func (s EntryImpl) GetSchema() *sdcpb.SchemaElem
- func (s EntryImpl) GetSchemaKeys() []string
- func (s EntryImpl) ImportConfig(ctx context.Context, t importer.ImportConfigAdapter, intentName string, ...) error
- func (s EntryImpl) IsRoot() bool
- func (s EntryImpl) Navigate(ctx context.Context, path []string, isRootPath bool) (Entry, error)
- func (s EntryImpl) NavigateLeafRef(ctx context.Context) ([]Entry, error)
- func (s EntryImpl) NavigateSdcpbPath(ctx context.Context, pathElems []*sdcpb.PathElem, isRootPath bool) (Entry, error)
- func (s EntryImpl) Path() PathSlice
- func (s EntryImpl) PathName() string
- func (s EntryImpl) SdcpbPath() (*sdcpb.Path, error)
- func (s EntryImpl) SdcpbPathInternal(spath []string) (*sdcpb.Path, error)
- func (s EntryImpl) String() string
- func (s EntryImpl) StringIndent(result []string) []string
- func (s EntryImpl) ToJson(onlyNewOrUpdated bool, ordered bool) (any, error)
- func (s EntryImpl) ToJsonIETF(onlyNewOrUpdated bool, ordered bool) (any, error)
- func (s EntryImpl) ToXML(...) (*etree.Document, error)
- func (s EntryImpl) Validate(ctx context.Context, errchan chan<- error, concurrent bool)
- func (s EntryImpl) Walk(f EntryVisitor) error
- type EntrySlice
- type EntryVisitor
- type LeafEntry
- func (l *LeafEntry) DropDeleteFlag()
- func (l *LeafEntry) GetDeleteFlag() bool
- func (l *LeafEntry) GetEntry() Entry
- func (l *LeafEntry) GetNewFlag() bool
- func (l *LeafEntry) GetRootBasedEntryChain() []Entry
- func (l *LeafEntry) GetUpdateFlag() bool
- func (l *LeafEntry) MarkDelete()
- func (l *LeafEntry) MarkUpdate(u *cache.Update)
- func (l *LeafEntry) String() string
- type LeafEntryFilter
- type LeafVariantSlice
- type LeafVariants
- func (lv *LeafVariants) Add(le *LeafEntry)
- func (lv *LeafVariants) GetByOwner(owner string) *LeafEntry
- func (lv *LeafVariants) GetHighestPrecedence(onlyNewOrUpdated bool, includeDefaults bool) *LeafEntry
- func (lv *LeafVariants) GetHighestPrecedenceValue() int32
- func (lv *LeafVariants) Items() iter.Seq[*LeafEntry]
- func (lv *LeafVariants) Length() int
- type OrderingMethod
- type PathSet
- type PathSlice
- type PathSlices
- type ResultUpdate
- type RootEntry
- func (s RootEntry) AddCacheUpdateRecursive(ctx context.Context, c *cache.Update, new bool) (Entry, error)
- func (s RootEntry) FilterChilds(keys map[string]string) ([]Entry, error)
- func (s RootEntry) FinishInsertionPhase()
- func (r *RootEntry) GetAncestorSchema() (*sdcpb.SchemaElem, int)
- func (s RootEntry) GetByOwner(owner string, result []*LeafEntry) []*LeafEntry
- func (r *RootEntry) GetDeletes(aggregatePaths bool) ([]DeleteEntry, error)
- func (r *RootEntry) GetDeletesForOwner(owner string) PathSlices
- func (s RootEntry) GetFirstAncestorWithSchema() (Entry, int)
- func (r *RootEntry) GetHighestPrecedence(onlyNewOrUpdated bool) LeafVariantSlice
- func (s RootEntry) GetLevel() int
- func (s RootEntry) GetParent() Entry
- func (s RootEntry) GetRoot() Entry
- func (s RootEntry) GetRootBasedEntryChain() []Entry
- func (s RootEntry) GetSchema() *sdcpb.SchemaElem
- func (s RootEntry) GetSchemaKeys() []string
- func (r *RootEntry) GetUpdatesForOwner(owner string) UpdateSlice
- func (s RootEntry) ImportConfig(ctx context.Context, t importer.ImportConfigAdapter, intentName string, ...) error
- func (s RootEntry) IsRoot() bool
- func (r *RootEntry) LoadIntendedStoreOwnerData(ctx context.Context, owner string, pathKeySet *PathSet)
- func (s RootEntry) Navigate(ctx context.Context, path []string, isRootPath bool) (Entry, error)
- func (s RootEntry) NavigateLeafRef(ctx context.Context) ([]Entry, error)
- func (s RootEntry) NavigateSdcpbPath(ctx context.Context, pathElems []*sdcpb.PathElem, isRootPath bool) (Entry, error)
- func (s RootEntry) Path() PathSlice
- func (s RootEntry) PathName() string
- func (s RootEntry) SdcpbPath() (*sdcpb.Path, error)
- func (s RootEntry) SdcpbPathInternal(spath []string) (*sdcpb.Path, error)
- func (r *RootEntry) String() string
- func (s RootEntry) StringIndent(result []string) []string
- func (s RootEntry) ToJson(onlyNewOrUpdated bool, ordered bool) (any, error)
- func (s RootEntry) ToJsonIETF(onlyNewOrUpdated bool, ordered bool) (any, error)
- func (r *RootEntry) ToProtoDeletes(ctx context.Context) ([]*sdcpb.Path, error)
- func (r *RootEntry) ToProtoUpdates(ctx context.Context, onlyNewOrUpdated bool) ([]*sdcpb.Update, error)
- func (s RootEntry) ToXML(...) (*etree.Document, error)
- func (s RootEntry) Validate(ctx context.Context, errchan chan<- error, concurrent bool)
- func (s RootEntry) Walk(f EntryVisitor) error
- type TreeContext
- func (t *TreeContext) GetActualOwner() string
- func (t *TreeContext) GetBranchesHighesPrecedence(path []string, filters ...CacheUpdateFilter) int32
- func (t *TreeContext) GetPathsOfOwner(owner string) *PathSet
- func (t *TreeContext) PathExists(path []string) bool
- func (tc *TreeContext) ReadCurrentUpdatesHighestPriorities(ctx context.Context, ccp PathSlices, count uint64) UpdateSlice
- func (t *TreeContext) ReadRunning(ctx context.Context, path PathSlice) (*cache.Update, error)
- func (t *TreeContext) ReadRunningFull(ctx context.Context) ([]*cache.Update, error)
- func (t *TreeContext) SetRoot(e Entry) error
- func (t *TreeContext) SetStoreIndex(si map[string]UpdateSlice)
- type TreeSchemaCacheClient
- type TreeSchemaCacheClientImpl
- func (c *TreeSchemaCacheClientImpl) GetSchema(ctx context.Context, path []string) (*sdcpb.GetSchemaResponse, error)
- func (c *TreeSchemaCacheClientImpl) Read(ctx context.Context, opts *cache.Opts, paths [][]string) []*cache.Update
- func (c *TreeSchemaCacheClientImpl) ToPath(ctx context.Context, path []string) (*sdcpb.Path, error)
- type UpdateSlice
Constants ¶
const ( KeysIndexSep = "_" DefaultValuesPrio = int32(math.MaxInt32 - 90) DefaultsIntentName = "default" RunningValuesPrio = int32(math.MaxInt32 - 100) RunningIntentName = "running" )
const (
PATHSEP = "/"
)
Variables ¶
This section is empty.
Functions ¶
func ApplyCacheUpdateFilters ¶
func ApplyCacheUpdateFilters(u *cache.Update, fs []CacheUpdateFilter) bool
ApplyCacheUpdateFilters takes a bunch of CacheUpdateFilters applies them in an AND fashion and returns the result.
func FilterDeleted ¶
FilterDeleted Accepts all Entries that are marked as deleted
func FilterNonDeleted ¶
FilterNonDeleted Accepts all Entries that are not marked as deleted
func FilterNonDeletedButNewOrUpdated ¶
FilterNonDeletedButNewOrUpdated Accepts all Entries that are New or Updated and not Deleted.
func FilterUpdated ¶
FilterUpdated Accepts all entries that are updates
func LeafEntriesToCacheUpdates ¶
LeafEntriesToCacheUpdates
func Unfiltered ¶
Unfiltered accepts all entries without any filtering
Types ¶
type CacheUpdateFilter ¶
type DeleteEntry ¶ added in v0.0.44
type DeleteEntryImpl ¶ added in v0.0.44
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 ¶ added in v0.0.44
func NewDeleteEntryImpl(sdcpbPath *sdcpb.Path, pathslice PathSlice) *DeleteEntryImpl
func (*DeleteEntryImpl) Path ¶ added in v0.0.44
func (d *DeleteEntryImpl) Path() PathSlice
type Entry ¶
type Entry interface { // Path returns the Path as PathSlice Path() PathSlice // PathName returns the last Path element, the name of the Entry PathName() string // AddCacheUpdateRecursive Add the given cache.Update to the tree AddCacheUpdateRecursive(ctx context.Context, u *cache.Update, new bool) (Entry, error) // StringIndent debug tree struct as indented string slice StringIndent(result []string) []string // GetHighesPrio return the new cache.Update entried from the tree that are the highes priority. // If the onlyNewOrUpdated option is set to true, only the New or Updated entries will be returned // It will append to the given list and provide a new pointer to the slice GetHighestPrecedence(result LeafVariantSlice, onlyNewOrUpdated bool) LeafVariantSlice // GetByOwner returns the branches Updates by owner GetByOwner(owner string, result []*LeafEntry) []*LeafEntry // GetDeletes returns the cache-updates that are not updated, have no lower priority value left and hence should be deleted completely GetDeletes(entries []DeleteEntry, aggregatePaths bool) ([]DeleteEntry, error) // Walk takes the EntryVisitor and applies it to every Entry in the tree Walk(f EntryVisitor) error // Validate kicks off validation Validate(ctx context.Context, errchan chan<- error, concurrent bool) // GetSchema returns the *sdcpb.SchemaElem of the Entry GetSchema() *sdcpb.SchemaElem // IsRoot returns true if the Entry is the root of the tree IsRoot() bool // FinishInsertionPhase indicates, that the insertion of Entries into the tree is over // Hence calculations for e.g. choice/case can be performed. FinishInsertionPhase() // GetParent returns the parent entry GetParent() Entry // Navigate navigates the tree according to the given path and returns the referenced entry or nil if it does not exist. NavigateLeafRef(ctx context.Context) ([]Entry, error) // GetFirstAncestorWithSchema returns the first parent node which has a schema set. // if the parent has no schema (is a key element in the tree) it will recurs the call to the parents parent. // the level of recursion is indicated via the levelUp attribute GetFirstAncestorWithSchema() (ancestor Entry, levelUp int) // SdcpbPath returns the sdcpb.Path struct for the Entry SdcpbPath() (*sdcpb.Path, error) // SdcpbPathInternal is the internal function to calculate the SdcpbPath SdcpbPathInternal(spath []string) (*sdcpb.Path, error) // GetSchemaKeys checks for the schema of the entry, and returns the defined keys GetSchemaKeys() []string // GetRootBasedEntryChain returns all the entries starting from the root down to the actual Entry. GetRootBasedEntryChain() []Entry // GetRoot returns the Trees Root Entry GetRoot() Entry FilterChilds(keys map[string]string) ([]Entry, error) // ToJson returns the Tree contained structure as JSON // use e.g. json.MarshalIndent() on the returned struct ToJson(onlyNewOrUpdated bool, ordered bool) (any, error) // ToJsonIETF returns the Tree contained structure as JSON_IETF // use e.g. json.MarshalIndent() on the returned struct ToJsonIETF(onlyNewOrUpdated bool, ordered bool) (any, error) ToXML(onlyNewOrUpdated bool, honorNamespace bool, operationWithNamespace bool, useOperationRemove bool, ordering OrderingMethod) (*etree.Document, error) // ImportConfig allows importing config data received from e.g. the device in different formats (json, xml) to be imported into the tree. ImportConfig(ctx context.Context, t importer.ImportConfigAdapter, intentName string, intentPrio int32) error // contains filtered or unexported methods }
Entry is the primary Element of the Tree.
type EntryImpl ¶
type EntryImpl struct {
// contains filtered or unexported fields
}
func (EntryImpl) AddCacheUpdateRecursive ¶
func (s EntryImpl) AddCacheUpdateRecursive(ctx context.Context, c *cache.Update, new bool) (Entry, error)
AddCacheUpdateRecursive recursively adds the given cache.Update to the tree. Thereby creating all the entries along the path. if the entries along th path already exist, the existing entries are called to add the Update.
func (EntryImpl) FilterChilds ¶ added in v0.0.43
FilterChilds returns the child entries (skipping the key entries in the tree) that match the given keys. The keys do not need to match all levels of keys, in which case the key level is considered a wildcard match (*)
func (EntryImpl) FinishInsertionPhase ¶
func (s EntryImpl) FinishInsertionPhase()
FinishInsertionPhase certain values that are costly to calculate but used multiple times will be calculated and stored for later use. However therefore the insertion phase into the tree needs to be over. Calling this function indicated the end of the phase and thereby triggers the calculation
func (EntryImpl) GetByOwner ¶
GetByOwner returns all the LeafEntries that belong to a certain owner.
func (EntryImpl) GetDeletes ¶
func (s EntryImpl) GetDeletes(deletes []DeleteEntry, aggregatePaths bool) ([]DeleteEntry, error)
GetDeletes calculate the deletes that need to be send to the device.
func (EntryImpl) GetFirstAncestorWithSchema ¶
GetAncestorSchema returns the schema of the parent node if the schema is set. if the parent has no schema (is a key element in the tree) it will recurs the call to the parents parent. the level of recursion is indicated via the levelUp attribute
func (EntryImpl) GetHighestPrecedence ¶
func (s EntryImpl) GetHighestPrecedence(result LeafVariantSlice, onlyNewOrUpdated bool) LeafVariantSlice
GetHighestPrecedence goes through the whole branch and returns the new and updated cache.Updates. These are the updated that will be send to the device.
func (EntryImpl) GetLevel ¶
func (s EntryImpl) GetLevel() int
GetLevel returns the level / depth position of this element in the tree
func (EntryImpl) GetParent ¶
func (s EntryImpl) GetParent() Entry
GetParent returns the parent entry
func (EntryImpl) GetRootBasedEntryChain ¶ added in v0.0.42
func (s EntryImpl) GetRootBasedEntryChain() []Entry
func (EntryImpl) GetSchema ¶
func (s EntryImpl) GetSchema() *sdcpb.SchemaElem
GetSchema return the schema fiels of the Entry
func (EntryImpl) GetSchemaKeys ¶
func (s EntryImpl) GetSchemaKeys() []string
GetSchemaKeys checks for the schema of the entry, and returns the defined keys
func (EntryImpl) ImportConfig ¶ added in v0.0.44
func (EntryImpl) IsRoot ¶
func (s EntryImpl) IsRoot() bool
IsRoot returns true if the element has no parent elements, hence is the root of the tree
func (EntryImpl) Navigate ¶
Navigate move through the tree, returns the Entry that is present under the given path
func (EntryImpl) NavigateLeafRef ¶ added in v0.0.43
NavigateLeafRef
func (EntryImpl) NavigateSdcpbPath ¶ added in v0.0.42
func (EntryImpl) Path ¶
func (s EntryImpl) Path() PathSlice
Path returns the root based path of the Entry
func (EntryImpl) PathName ¶
func (s EntryImpl) PathName() string
PathName returns the name of the Entry
func (EntryImpl) SdcpbPath ¶
SdcpbPath returns the sdcpb.Path, with its elements and keys based on the local schema
func (EntryImpl) SdcpbPathInternal ¶
sdcpbPathInternal is the internale recursive function to calculate and the sdcpb.Path, with its elements and keys based on the local schema
func (EntryImpl) String ¶
func (s EntryImpl) String() string
String returns a string representation of the Entry
func (EntryImpl) StringIndent ¶
StringIndent returns the sharedEntryAttributes in its string representation The string is intented according to the nesting level in the yang model
func (EntryImpl) ToJsonIETF ¶ added in v0.0.44
func (EntryImpl) ToXML ¶ added in v0.0.44
func (s EntryImpl) ToXML(onlyNewOrUpdated, honorNamespace, operationWithNamespace, useOperationRemove bool, ordering OrderingMethod) (*etree.Document, error)
ToXML yields the xml representation of the tree. Either updates only (onlyNewOrUpdated flag) or the actual view on the whole tree. If honorNamespace is set, the xml elements will carry their respective namespace attributes. If operationWithNamespace is set, the operation attributes added to the to be deleted alements will also carry the Netconf Base namespace. If useOperationRemove is set, the remove operation will be used for deletes, instead of the delete operation.
func (EntryImpl) Validate ¶
Validate is the highlevel function to perform validation. it will multiplex all the different Validations that need to happen
func (EntryImpl) Walk ¶
func (s EntryImpl) Walk(f EntryVisitor) error
Walk takes the EntryVisitor and applies it to every Entry in the tree
type EntrySlice ¶ added in v0.0.44
type EntrySlice []Entry
type EntryVisitor ¶
type EntryVisitor func(s *sharedEntryAttributes) error
type LeafEntry ¶
type LeafEntry struct { *cache.Update IsNew bool Delete bool IsUpdated bool // contains filtered or unexported fields }
LeafEntry stores the *cache.Update along with additional attributes. These Attributes indicate if the entry is to be deleted / added (new) or updated.
func NewLeafEntry ¶
NewLeafEntry constructor for a new LeafEntry
func (*LeafEntry) DropDeleteFlag ¶ added in v0.0.50
func (l *LeafEntry) DropDeleteFlag()
func (*LeafEntry) GetDeleteFlag ¶ added in v0.0.50
func (*LeafEntry) GetNewFlag ¶ added in v0.0.50
func (*LeafEntry) GetRootBasedEntryChain ¶ added in v0.0.42
func (*LeafEntry) GetUpdateFlag ¶ added in v0.0.50
func (*LeafEntry) MarkDelete ¶
func (l *LeafEntry) MarkDelete()
MarkDelete indicate that the entry is to be deleted
func (*LeafEntry) MarkUpdate ¶
MarkUpdate indicate that the entry is an Updated value
type LeafEntryFilter ¶
type LeafVariantSlice ¶ added in v0.0.42
type LeafVariantSlice []*LeafEntry
func (LeafVariantSlice) ToCacheUpdateSlice ¶ added in v0.0.42
func (lvs LeafVariantSlice) ToCacheUpdateSlice() []*cache.Update
type LeafVariants ¶
type LeafVariants struct {
// contains filtered or unexported fields
}
func (*LeafVariants) Add ¶ added in v0.0.50
func (lv *LeafVariants) Add(le *LeafEntry)
func (*LeafVariants) GetByOwner ¶
func (lv *LeafVariants) GetByOwner(owner string) *LeafEntry
GetByOwner returns the entry that is owned by the given owner, returns nil if no entry exists.
func (*LeafVariants) GetHighestPrecedence ¶
func (lv *LeafVariants) GetHighestPrecedence(onlyNewOrUpdated bool, includeDefaults bool) *LeafEntry
GetHighesNewUpdated returns the LeafEntry with the highes priority nil if no leaf entry exists.
func (*LeafVariants) GetHighestPrecedenceValue ¶
func (lv *LeafVariants) GetHighestPrecedenceValue() int32
func (*LeafVariants) Items ¶ added in v0.0.49
func (lv *LeafVariants) Items() iter.Seq[*LeafEntry]
Items iterator for the LeafVariants
func (*LeafVariants) Length ¶ added in v0.0.49
func (lv *LeafVariants) Length() int
type OrderingMethod ¶ added in v0.0.51
type OrderingMethod uint
const ( None OrderingMethod = iota Alphabetical SchemaBound )
type PathSet ¶
type PathSet struct {
// contains filtered or unexported fields
}
func NewPathSet ¶
func NewPathSet() *PathSet
func (*PathSet) GetPaths ¶
func (p *PathSet) GetPaths() PathSlices
type PathSlice ¶
type PathSlice []string
PathSlice is a single Path represented as a string slice
func (PathSlice) ToStringSlice ¶ added in v0.0.40
type PathSlices ¶ added in v0.0.40
type PathSlices []PathSlice
PathSlices is the slice collection of multiple PathSlice objects.
func (PathSlices) StringSlice ¶ added in v0.0.40
func (p PathSlices) StringSlice() []string
func (PathSlices) ToStringSlice ¶ added in v0.0.40
func (p PathSlices) ToStringSlice() [][]string
type ResultUpdate ¶
type ResultUpdate struct {
// contains filtered or unexported fields
}
func (*ResultUpdate) GetTreeEntry ¶
func (r *ResultUpdate) GetTreeEntry() Entry
func (*ResultUpdate) GetUpdate ¶
func (r *ResultUpdate) GetUpdate() *cache.Update
type RootEntry ¶
type RootEntry struct {
// contains filtered or unexported fields
}
RootEntry the root of the cache.Update tree
func NewTreeRoot ¶
func NewTreeRoot(ctx context.Context, tc *TreeContext) (*RootEntry, error)
NewTreeRoot Instantiate a new Tree Root element.
func (RootEntry) AddCacheUpdateRecursive ¶
func (s RootEntry) AddCacheUpdateRecursive(ctx context.Context, c *cache.Update, new bool) (Entry, error)
AddCacheUpdateRecursive recursively adds the given cache.Update to the tree. Thereby creating all the entries along the path. if the entries along th path already exist, the existing entries are called to add the Update.
func (RootEntry) FilterChilds ¶ added in v0.0.43
FilterChilds returns the child entries (skipping the key entries in the tree) that match the given keys. The keys do not need to match all levels of keys, in which case the key level is considered a wildcard match (*)
func (RootEntry) FinishInsertionPhase ¶
func (s RootEntry) FinishInsertionPhase()
FinishInsertionPhase certain values that are costly to calculate but used multiple times will be calculated and stored for later use. However therefore the insertion phase into the tree needs to be over. Calling this function indicated the end of the phase and thereby triggers the calculation
func (*RootEntry) GetAncestorSchema ¶
func (r *RootEntry) GetAncestorSchema() (*sdcpb.SchemaElem, int)
func (RootEntry) GetByOwner ¶
GetByOwner returns all the LeafEntries that belong to a certain owner.
func (*RootEntry) GetDeletes ¶
func (r *RootEntry) GetDeletes(aggregatePaths bool) ([]DeleteEntry, error)
GetDeletes returns the paths that due to the Tree content are to be deleted from the southbound device.
func (*RootEntry) GetDeletesForOwner ¶
func (r *RootEntry) GetDeletesForOwner(owner string) PathSlices
GetDeletesForOwner returns the deletes that have been calculated for the given intent / owner
func (RootEntry) GetFirstAncestorWithSchema ¶
GetAncestorSchema returns the schema of the parent node if the schema is set. if the parent has no schema (is a key element in the tree) it will recurs the call to the parents parent. the level of recursion is indicated via the levelUp attribute
func (*RootEntry) GetHighestPrecedence ¶
func (r *RootEntry) GetHighestPrecedence(onlyNewOrUpdated bool) LeafVariantSlice
GetHighesPrecedence return the new cache.Update entried from the tree that are the highes priority. If the onlyNewOrUpdated option is set to true, only the New or Updated entries will be returned It will append to the given list and provide a new pointer to the slice
func (RootEntry) GetLevel ¶
func (s RootEntry) GetLevel() int
GetLevel returns the level / depth position of this element in the tree
func (RootEntry) GetParent ¶
func (s RootEntry) GetParent() Entry
GetParent returns the parent entry
func (RootEntry) GetRootBasedEntryChain ¶ added in v0.0.42
func (s RootEntry) GetRootBasedEntryChain() []Entry
func (RootEntry) GetSchema ¶
func (s RootEntry) GetSchema() *sdcpb.SchemaElem
GetSchema return the schema fiels of the Entry
func (RootEntry) GetSchemaKeys ¶
func (s RootEntry) GetSchemaKeys() []string
GetSchemaKeys checks for the schema of the entry, and returns the defined keys
func (*RootEntry) GetUpdatesForOwner ¶
func (r *RootEntry) GetUpdatesForOwner(owner string) UpdateSlice
GetUpdatesForOwner returns the updates that have been calculated for the given intent / owner
func (RootEntry) ImportConfig ¶ added in v0.0.44
func (RootEntry) IsRoot ¶
func (s RootEntry) IsRoot() bool
IsRoot returns true if the element has no parent elements, hence is the root of the tree
func (*RootEntry) LoadIntendedStoreOwnerData ¶
func (RootEntry) Navigate ¶
Navigate move through the tree, returns the Entry that is present under the given path
func (RootEntry) NavigateLeafRef ¶ added in v0.0.43
NavigateLeafRef
func (RootEntry) NavigateSdcpbPath ¶ added in v0.0.42
func (RootEntry) Path ¶
func (s RootEntry) Path() PathSlice
Path returns the root based path of the Entry
func (RootEntry) PathName ¶
func (s RootEntry) PathName() string
PathName returns the name of the Entry
func (RootEntry) SdcpbPath ¶
SdcpbPath returns the sdcpb.Path, with its elements and keys based on the local schema
func (RootEntry) SdcpbPathInternal ¶
sdcpbPathInternal is the internale recursive function to calculate and the sdcpb.Path, with its elements and keys based on the local schema
func (RootEntry) StringIndent ¶
StringIndent returns the sharedEntryAttributes in its string representation The string is intented according to the nesting level in the yang model
func (RootEntry) ToJsonIETF ¶ added in v0.0.44
func (*RootEntry) ToProtoDeletes ¶ added in v0.0.44
func (*RootEntry) ToProtoUpdates ¶ added in v0.0.44
func (RootEntry) ToXML ¶ added in v0.0.44
func (s RootEntry) ToXML(onlyNewOrUpdated, honorNamespace, operationWithNamespace, useOperationRemove bool, ordering OrderingMethod) (*etree.Document, error)
ToXML yields the xml representation of the tree. Either updates only (onlyNewOrUpdated flag) or the actual view on the whole tree. If honorNamespace is set, the xml elements will carry their respective namespace attributes. If operationWithNamespace is set, the operation attributes added to the to be deleted alements will also carry the Netconf Base namespace. If useOperationRemove is set, the remove operation will be used for deletes, instead of the delete operation.
func (RootEntry) Validate ¶
Validate is the highlevel function to perform validation. it will multiplex all the different Validations that need to happen
func (RootEntry) Walk ¶
func (s RootEntry) Walk(f EntryVisitor) error
Walk takes the EntryVisitor and applies it to every Entry in the tree
type TreeContext ¶
type TreeContext struct { IntendedStoreIndex map[string]UpdateSlice // contains the keys that the intended store holds in the cache RunningStoreIndex map[string]*cache.Update // contains the keys of the running config // contains filtered or unexported fields }
func NewTreeContext ¶
func NewTreeContext(tscc TreeSchemaCacheClient, actualOwner string) *TreeContext
func (*TreeContext) GetActualOwner ¶
func (t *TreeContext) GetActualOwner() string
func (*TreeContext) GetBranchesHighesPrecedence ¶
func (t *TreeContext) GetBranchesHighesPrecedence(path []string, filters ...CacheUpdateFilter) int32
func (*TreeContext) GetPathsOfOwner ¶
func (t *TreeContext) GetPathsOfOwner(owner string) *PathSet
func (*TreeContext) PathExists ¶
func (t *TreeContext) PathExists(path []string) bool
func (*TreeContext) ReadCurrentUpdatesHighestPriorities ¶
func (tc *TreeContext) ReadCurrentUpdatesHighestPriorities(ctx context.Context, ccp PathSlices, count uint64) UpdateSlice
func (*TreeContext) ReadRunning ¶
ReadRunning reads the value from running if the value does not exist, nil is returned
func (*TreeContext) ReadRunningFull ¶ added in v0.0.44
ReadRunning reads the value from running if the value does not exist, nil is returned
func (*TreeContext) SetRoot ¶
func (t *TreeContext) SetRoot(e Entry) error
func (*TreeContext) SetStoreIndex ¶
func (t *TreeContext) SetStoreIndex(si map[string]UpdateSlice)
type TreeSchemaCacheClient ¶
type TreeSchemaCacheClient interface { // CACHE based Functions // ReadIntended retrieves the highes priority value from the intended store Read(ctx context.Context, opts *cache.Opts, paths [][]string) []*cache.Update // SCHEMA based Functions GetSchema(ctx context.Context, path []string) (*sdcpb.GetSchemaResponse, error) ToPath(ctx context.Context, path []string) (*sdcpb.Path, error) }
type TreeSchemaCacheClientImpl ¶
type TreeSchemaCacheClientImpl struct {
// contains filtered or unexported fields
}
func NewTreeSchemaCacheClient ¶
func NewTreeSchemaCacheClient(datastore string, cc cache.Client, scb SchemaClient.SchemaClientBound) *TreeSchemaCacheClientImpl
func (*TreeSchemaCacheClientImpl) GetSchema ¶
func (c *TreeSchemaCacheClientImpl) GetSchema(ctx context.Context, path []string) (*sdcpb.GetSchemaResponse, error)
GetSchema retrieves the given schema element from the schema-server. relies on TreeSchemaCacheClientImpl.retrieveSchema(...) to source the internal lookup index (cache) of schemas
type UpdateSlice ¶
UpdateSlice A slice of *cache.Update, that defines additional helper functions.
func (UpdateSlice) GetLowestPriorityValue ¶
func (u UpdateSlice) GetLowestPriorityValue(filters []CacheUpdateFilter) int32
GetHighesPriorityValue returns the highes priority value of all the containing Updates
Source Files ¶
- cache_update_filter.go
- choice_case_resolver.go
- entry.go
- entry_list.go
- json.go
- key_set.go
- leaf_entry.go
- leaf_entry_filter.go
- leaf_variant_slice.go
- leaf_variants.go
- path_slices.go
- proto.go
- result_update.go
- root_entry.go
- schema_index.go
- sharedEntryAttributes.go
- sorter.go
- tree_context.go
- tree_schema_cache_client.go
- update_slice.go
- validation_entry_leafref.go
- validation_entry_must.go
- xml.go
- yang-parser-adapter.go