tree

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: 26 Imported by: 2

Documentation

Index

Constants

View Source
const (
	KeysIndexSep       = "_"
	DefaultValuesPrio  = int32(math.MaxInt32 - 90)
	DefaultsIntentName = "default"
	RunningValuesPrio  = int32(math.MaxInt32 - 100)
	RunningIntentName  = "running"
	ReplaceValuesPrio  = int32(math.MaxInt32 - 110)
	ReplaceIntentName  = "replace"
)

Variables

View Source
var (
	ErrorIntentNotPresent = fmt.Errorf("intent not present")
)

Functions

func DefaultValueExists added in v0.0.56

func DefaultValueExists(schema *sdcpb.SchemaElem) bool

func DefaultValueRetrieve added in v0.0.56

func DefaultValueRetrieve(schema *sdcpb.SchemaElem, path *sdcpb.Path) (*types.Update, error)

func FilterDeleted

func FilterDeleted(l *LeafEntry) bool

FilterDeleted Accepts all Entries that are marked as deleted

func FilterDeletedNotExplicitDelete added in v0.0.63

func FilterDeletedNotExplicitDelete(l *LeafEntry) bool

func FilterNew

func FilterNew(l *LeafEntry) bool

FilterNew Accepts New LeafEntries

func FilterNonDeleted

func FilterNonDeleted(l *LeafEntry) bool

FilterNonDeleted Accepts all Entries that are not marked as deleted

func FilterNonDeletedButNewOrUpdated

func FilterNonDeletedButNewOrUpdated(l *LeafEntry) bool

FilterNonDeletedButNewOrUpdated Accepts all Entries that are New or Updated and not Deleted.

func FilterUpdated

func FilterUpdated(l *LeafEntry) bool

FilterUpdated Accepts all entries that are updates

func HighestPrecedenceFilterAll added in v0.0.56

func HighestPrecedenceFilterAll(le *LeafEntry) bool

func HighestPrecedenceFilterWithoutDeleted added in v0.0.56

func HighestPrecedenceFilterWithoutDeleted(le *LeafEntry) bool

func HighestPrecedenceFilterWithoutNew added in v0.0.56

func HighestPrecedenceFilterWithoutNew(le *LeafEntry) bool

func LeafEntriesToUpdates added in v0.0.56

func LeafEntriesToUpdates(l []*LeafEntry) []*types.Update

LeafEntriesToCacheUpdates

func Unfiltered

func Unfiltered(l *LeafEntry) bool

Unfiltered accepts all entries without any filtering

Types

type BaseVisitor added in v0.0.63

type BaseVisitor struct{}

BaseVisitor abstract base visitor implementation that all the concrete visitory are ment to embed.

func (*BaseVisitor) DescendMethod added in v0.0.63

func (b *BaseVisitor) DescendMethod() DescendMethod

func (*BaseVisitor) Up added in v0.0.63

func (b *BaseVisitor) Up()

type BlameConfigVisitor added in v0.0.63

type BlameConfigVisitor struct {
	BaseVisitor
	// contains filtered or unexported fields
}

func NewBlameConfigVisitor added in v0.0.63

func NewBlameConfigVisitor(includeDefaults bool) *BlameConfigVisitor

func (*BlameConfigVisitor) DescendMethod added in v0.0.63

func (o *BlameConfigVisitor) DescendMethod() DescendMethod

func (*BlameConfigVisitor) GetResult added in v0.0.63

func (b *BlameConfigVisitor) GetResult() *sdcpb.BlameTreeElement

func (*BlameConfigVisitor) Up added in v0.0.63

func (b *BlameConfigVisitor) Up()

func (*BlameConfigVisitor) Visit added in v0.0.63

func (b *BlameConfigVisitor) Visit(ctx context.Context, e Entry) error

type DeletePathPrio added in v0.0.63

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

func NewDeletePathPrio added in v0.0.63

func NewDeletePathPrio(owner string, prio int32) *DeletePathPrio

func (*DeletePathPrio) DeepCopy added in v0.0.63

func (ddp *DeletePathPrio) DeepCopy() *DeletePathPrio

func (*DeletePathPrio) GetOwner added in v0.0.63

func (dpp *DeletePathPrio) GetOwner() string

func (*DeletePathPrio) GetPathSet added in v0.0.63

func (dpp *DeletePathPrio) GetPathSet() *sdcpb.PathSet

func (*DeletePathPrio) GetPrio added in v0.0.63

func (dpp *DeletePathPrio) GetPrio() int32

func (*DeletePathPrio) PathItems added in v0.0.63

func (dpp *DeletePathPrio) PathItems() iter.Seq[*sdcpb.Path]

type DeletePathSet added in v0.0.63

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

func NewDeletePaths added in v0.0.63

func NewDeletePaths() *DeletePathSet

func (*DeletePathSet) Add added in v0.0.63

func (dp *DeletePathSet) Add(intentName string, prio int32, pathset *sdcpb.PathSet)

func (*DeletePathSet) DeepCopy added in v0.0.63

func (dp *DeletePathSet) DeepCopy() *DeletePathSet

func (*DeletePathSet) GetByIntentName added in v0.0.63

func (dp *DeletePathSet) GetByIntentName(intentName string) *sdcpb.PathSet

func (*DeletePathSet) Items added in v0.0.63

func (dp *DeletePathSet) Items() iter.Seq[*DeletePathPrio]

func (*DeletePathSet) RemoveIntentDeletes added in v0.0.63

func (dp *DeletePathSet) RemoveIntentDeletes(intentName string) *sdcpb.PathSet

type DescendMethod added in v0.0.63

type DescendMethod int
const (
	DescendMethodAll DescendMethod = iota
	DescendMethodActiveChilds
)

type Entry

type Entry interface {
	// PathName returns the last Path element, the name of the Entry
	PathName() string
	// GetLevel returns the depth of the Entry in the tree
	GetLevel() int

	// AddUpdateRecursive Add the given cache.Update to the tree
	AddUpdateRecursive(ctx context.Context, relativePath *sdcpb.Path, u *types.Update, flags *types.UpdateInsertFlags) (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, includeDefaults bool, includeExplicitDelete bool) LeafVariantSlice

	// GetByOwner returns the branches Updates by owner
	GetByOwner(owner string, result []*LeafEntry) LeafVariantSlice
	// // markOwnerDelete Sets the delete flag on all the LeafEntries belonging to the given owner.
	// MarkOwnerDelete(o string, onlyIntended bool)
	// GetDeletes returns the cache-updates that are not updated, have no lower priority value left and hence should be deleted completely
	GetDeletes(entries []types.DeleteEntry, aggregatePaths bool) ([]types.DeleteEntry, error)
	// Walk takes the EntryVisitor and applies it to every Entry in the tree
	Walk(ctx context.Context, v EntryVisitor) error
	// Validate kicks off validation
	Validate(ctx context.Context, resultChan chan<- *types.ValidationResultEntry, stats *types.ValidationStats, vCfg *config.Validation)

	// 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(ctx context.Context) error
	// GetParent returns the parent entry
	GetParent() Entry
	NavigateSdcpbPath(ctx context.Context, path *sdcpb.Path) (Entry, error)
	// NavigateLeafRef follows the leafref and returns the referenced entry
	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
	// 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

	GetChilds(DescendMethod) EntryMap
	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) (any, error)
	// ToJsonIETF returns the Tree contained structure as JSON_IETF
	// use e.g. json.MarshalIndent() on the returned struct
	ToJsonIETF(onlyNewOrUpdated bool) (any, error)

	// ToXML returns the tree and its current state in the XML representation used by netconf
	ToXML(onlyNewOrUpdated bool, honorNamespace bool, operationWithNamespace bool, useOperationRemove bool) (*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, importer importer.ImportConfigAdapterElement, intentName string, intentPrio int32, flags *types.UpdateInsertFlags) error
	TreeExport(owner string) ([]*tree_persist.TreeElement, error)
	// DeleteBranch Deletes from the tree, all elements of the PathSlice defined branch of the given owner
	DeleteBranch(ctx context.Context, path *sdcpb.Path, owner string) (err error)
	GetDeviations(ch chan<- *types.DeviationEntry, activeCase bool)
	// GetListChilds collects all the childs of the list. In the tree we store them seperated into their key branches.
	// this is collecting all the last level key entries.
	GetListChilds() ([]Entry, error)
	BreadthSearch(ctx context.Context, path *sdcpb.Path) ([]Entry, error)
	DeepCopy(tc *TreeContext, parent Entry) (Entry, error)
	GetLeafVariantEntries() LeafVariantEntries

	// returns true if the Entry contains leafvariants (presence container, field or leaflist)
	HoldsLeafvariants() bool
	// contains filtered or unexported methods
}

Entry is the primary Element of the Tree.

type EntryMap added in v0.0.63

type EntryMap map[string]Entry

type EntrySlice added in v0.0.44

type EntrySlice []Entry

type EntryVisitor

type EntryVisitor interface {
	DescendMethod() DescendMethod
	Visit(ctx context.Context, e Entry) error
	Up()
}

type ExplicitDeleteVisitor added in v0.0.63

type ExplicitDeleteVisitor struct {
	BaseVisitor
	// contains filtered or unexported fields
}

func NewExplicitDeleteVisitor added in v0.0.63

func NewExplicitDeleteVisitor(owner string, priority int32) *ExplicitDeleteVisitor

func (*ExplicitDeleteVisitor) GetCreatedExplicitDeleteLeafEntries added in v0.0.63

func (edv *ExplicitDeleteVisitor) GetCreatedExplicitDeleteLeafEntries() LeafVariantSlice

GetCreatedExplicitDeleteLeafEntries returns all the explicitDelete LeafVariants that where created.

func (*ExplicitDeleteVisitor) GetExplicitDeleteCreationCount added in v0.0.63

func (edv *ExplicitDeleteVisitor) GetExplicitDeleteCreationCount() int

GetExplicitDeleteCreationCount returns the amount of all the explicitDelete LeafVariants that where created.

func (*ExplicitDeleteVisitor) Visit added in v0.0.63

func (edv *ExplicitDeleteVisitor) Visit(ctx context.Context, e Entry) error

type ExplicitDeleteVisitors added in v0.0.63

type ExplicitDeleteVisitors map[string]*ExplicitDeleteVisitor

ExplicitDeleteVisitors map of *ExplicitDeleteVisitor indexed by the intent name

func (ExplicitDeleteVisitors) Stats added in v0.0.63

func (e ExplicitDeleteVisitors) Stats() map[string]int

type HighestPrecedenceFilter added in v0.0.56

type HighestPrecedenceFilter func(le *LeafEntry) bool

type LeafEntry

type LeafEntry struct {
	*types.Update

	IsNew              bool
	Delete             bool
	DeleteOnlyIntended bool
	IsUpdated          bool
	IsExplicitDelete   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

func NewLeafEntry(c *types.Update, flags *types.UpdateInsertFlags, parent Entry) *LeafEntry

NewLeafEntry constructor for a new LeafEntry

func (*LeafEntry) Compare added in v0.0.63

func (l *LeafEntry) Compare(other *LeafEntry) int

Compare used for slices.SortFunc. Sorts by path and if equal paths then by owner as the second criteria

func (*LeafEntry) DeepCopy added in v0.0.56

func (l *LeafEntry) DeepCopy(parentEntry Entry) *LeafEntry

func (*LeafEntry) DropDeleteFlag added in v0.0.50

func (l *LeafEntry) DropDeleteFlag() *LeafEntry

func (*LeafEntry) Equal added in v0.0.63

func (l *LeafEntry) Equal(other *LeafEntry) bool

func (*LeafEntry) GetDeleteFlag added in v0.0.50

func (l *LeafEntry) GetDeleteFlag() bool

func (*LeafEntry) GetDeleteOnlyIntendedFlag added in v0.0.54

func (l *LeafEntry) GetDeleteOnlyIntendedFlag() bool

func (*LeafEntry) GetEntry added in v0.0.42

func (l *LeafEntry) GetEntry() Entry

func (*LeafEntry) GetExplicitDeleteFlag added in v0.0.63

func (l *LeafEntry) GetExplicitDeleteFlag() bool

func (*LeafEntry) GetNewFlag added in v0.0.50

func (l *LeafEntry) GetNewFlag() bool

func (*LeafEntry) GetUpdate added in v0.0.64

func (l *LeafEntry) GetUpdate() *types.Update

func (*LeafEntry) GetUpdateFlag added in v0.0.50

func (l *LeafEntry) GetUpdateFlag() bool

func (*LeafEntry) MarkDelete

func (l *LeafEntry) MarkDelete(onlyIntended bool)

MarkDelete indicate that the entry is to be deleted

func (*LeafEntry) MarkExpliciteDelete added in v0.0.63

func (l *LeafEntry) MarkExpliciteDelete()

MarkExpliciteDelete indicate that the entry is to be explicitely deleted

func (*LeafEntry) MarkNew added in v0.0.54

func (l *LeafEntry) MarkNew()

func (*LeafEntry) MarkUpdate

func (l *LeafEntry) MarkUpdate(u *types.Update)

MarkUpdate indicate that the entry is an Updated value

func (*LeafEntry) RemoveDeleteFlag added in v0.0.61

func (l *LeafEntry) RemoveDeleteFlag() *LeafEntry

func (*LeafEntry) String

func (l *LeafEntry) String() string

String returns a string representation of the LeafEntry

type LeafEntryFilter

type LeafEntryFilter func(*LeafEntry) bool

type LeafVariantEntries added in v0.0.63

type LeafVariantEntries interface {
	MarkOwnerForDeletion(owner string, onlyIntended bool) *LeafEntry
	GetHighestPrecedence(onlyNewOrUpdated bool, includeDefaults bool, includeExplicitDeletes bool) *LeafEntry
	GetRunning() *LeafEntry
	DeleteByOwner(owner string) *LeafEntry
	AddExplicitDeleteEntry(owner string, priority int32) *LeafEntry
	GetByOwner(owner string) *LeafEntry
}

type LeafVariantEntry added in v0.0.63

type LeafVariantEntry interface {
	MarkDelete(onlyIntended bool) *LeafEntry
	GetEntry() Entry
	String() string
}

type LeafVariantSlice added in v0.0.42

type LeafVariantSlice []*LeafEntry

func (LeafVariantSlice) Equal added in v0.0.63

func (lvs LeafVariantSlice) Equal(otherLvs LeafVariantSlice) (bool, error)

Equal checks equality of the LeafVariantSlice with the other LeafVariantSlice

func (LeafVariantSlice) String added in v0.0.63

func (lvs LeafVariantSlice) String() string

func (LeafVariantSlice) ToSdcpbUpdateSlice added in v0.0.64

func (lvs LeafVariantSlice) ToSdcpbUpdateSlice() []*sdcpb.Update

func (LeafVariantSlice) ToUpdateSlice added in v0.0.56

func (lvs LeafVariantSlice) ToUpdateSlice() types.UpdateSlice

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

func (lv *LeafVariants) AddExplicitDeleteEntry(intentName string, priority int32) *LeafEntry

func (*LeafVariants) DeepCopy added in v0.0.56

func (lv *LeafVariants) DeepCopy(tc *TreeContext, parent Entry) *LeafVariants

func (*LeafVariants) DeleteByOwner added in v0.0.56

func (lv *LeafVariants) DeleteByOwner(owner string) *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) GetDeviations added in v0.0.56

func (lv *LeafVariants) GetDeviations(ch chan<- *types.DeviationEntry, isActiveCase bool)

func (*LeafVariants) GetHighestPrecedence

func (lv *LeafVariants) GetHighestPrecedence(onlyNewOrUpdated bool, includeDefaults bool, includeExplicitDelete bool) *LeafEntry

GetHighesNewUpdated returns the LeafEntry with the highes priority nil if no leaf entry exists.

func (*LeafVariants) GetHighestPrecedenceValue

func (lv *LeafVariants) GetHighestPrecedenceValue(filter HighestPrecedenceFilter) int32

func (*LeafVariants) GetRunning added in v0.0.60

func (lv *LeafVariants) GetRunning() *LeafEntry

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

func (*LeafVariants) MarkOwnerForDeletion added in v0.0.56

func (lv *LeafVariants) MarkOwnerForDeletion(owner string, onlyIntended bool) *LeafEntry

MarkOwnerForDeletion searches for a LefVariant of given owner, if it exists the entry is marked for deletion. returning the leafentry if an owner entry was found, nil if not.

type MarkOwnerDeleteVisitor added in v0.0.63

type MarkOwnerDeleteVisitor struct {
	BaseVisitor
	// contains filtered or unexported fields
}

func NewMarkOwnerDeleteVisitor added in v0.0.63

func NewMarkOwnerDeleteVisitor(owner string, onlyIntended bool) *MarkOwnerDeleteVisitor

func (*MarkOwnerDeleteVisitor) GetHitCount added in v0.0.63

func (o *MarkOwnerDeleteVisitor) GetHitCount() int

GetHitCount returns the number of entries marked for deletion

func (*MarkOwnerDeleteVisitor) GetMatches added in v0.0.63

func (o *MarkOwnerDeleteVisitor) GetMatches() LeafVariantSlice

GetMatches return all the altered LeafVariants

func (*MarkOwnerDeleteVisitor) Visit added in v0.0.63

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

func (r *RootEntry) AddExplicitDeletes(intentName string, priority int32, pathset *sdcpb.PathSet)

func (RootEntry) AddUpdateRecursive added in v0.0.56

func (s RootEntry) AddUpdateRecursive(ctx context.Context, path *sdcpb.Path, u *types.Update, flags *types.UpdateInsertFlags) (Entry, error)

AddUpdateRecursive 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) AddUpdatesRecursive added in v0.0.56

func (r *RootEntry) AddUpdatesRecursive(ctx context.Context, us types.UpdateSlice, flags *types.UpdateInsertFlags) error

func (RootEntry) BreadthSearch added in v0.0.56

func (s RootEntry) BreadthSearch(ctx context.Context, sdcpbPath *sdcpb.Path) ([]Entry, error)

func (*RootEntry) DeepCopy added in v0.0.54

func (r *RootEntry) DeepCopy(ctx context.Context) (*RootEntry, error)

func (RootEntry) DeleteBranch added in v0.0.63

func (s RootEntry) DeleteBranch(ctx context.Context, path *sdcpb.Path, owner string) error

func (*RootEntry) DeleteBranchPaths added in v0.0.63

func (r *RootEntry) DeleteBranchPaths(ctx context.Context, deletes types.DeleteEntriesList, intentName string) error

DeleteSubtree Deletes from the tree, all elements of the PathSlice defined branch of the given owner. Return values are remainsToExist and error if an error occured.

func (RootEntry) FilterChilds added in v0.0.43

func (s RootEntry) FilterChilds(keys map[string]string) ([]Entry, error)

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 (r *RootEntry) FinishInsertionPhase(ctx context.Context) error

func (*RootEntry) GetAncestorSchema

func (r *RootEntry) GetAncestorSchema() (*sdcpb.SchemaElem, int)

func (RootEntry) GetByOwner

func (s RootEntry) GetByOwner(owner string, result []*LeafEntry) LeafVariantSlice

GetByOwner returns all the LeafEntries that belong to a certain owner.

func (RootEntry) GetChilds added in v0.0.63

func (s RootEntry) GetChilds(d DescendMethod) EntryMap

func (*RootEntry) GetDeletes

func (r *RootEntry) GetDeletes(aggregatePaths bool) (types.DeleteEntriesList, 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) sdcpb.Paths

GetDeletesForOwner returns the deletes that have been calculated for the given intent / owner

func (*RootEntry) GetDeviations added in v0.0.56

func (r *RootEntry) GetDeviations(ch chan<- *types.DeviationEntry)

func (RootEntry) GetFirstAncestorWithSchema

func (s RootEntry) GetFirstAncestorWithSchema() (Entry, int)

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

func (s RootEntry) GetLeafVariantEntries() LeafVariantEntries

func (RootEntry) GetLevel

func (s RootEntry) GetLevel() int

GetLevel returns the level / depth position of this element in the tree

func (RootEntry) GetListChilds added in v0.0.56

func (s RootEntry) GetListChilds() ([]Entry, error)

getListChilds collects all the childs of the list. In the tree we store them seperated into their key branches. this is collecting all the last level key entries.

func (RootEntry) GetParent

func (s RootEntry) GetParent() Entry

GetParent returns the parent entry

func (RootEntry) GetRoot added in v0.0.42

func (s RootEntry) GetRoot() 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) types.UpdateSlice

GetUpdatesForOwner returns the updates that have been calculated for the given intent / owner

func (RootEntry) HoldsLeafvariants added in v0.0.63

func (s RootEntry) HoldsLeafvariants() bool

func (*RootEntry) ImportConfig added in v0.0.44

func (r *RootEntry) ImportConfig(ctx context.Context, basePath *sdcpb.Path, importer importer.ImportConfigAdapter, intentName string, intentPrio int32, flags *types.UpdateInsertFlags) error

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) NavigateLeafRef added in v0.0.43

func (s RootEntry) NavigateLeafRef(ctx context.Context) ([]Entry, error)

NavigateLeafRef

func (RootEntry) NavigateSdcpbPath added in v0.0.42

func (s RootEntry) NavigateSdcpbPath(ctx context.Context, path *sdcpb.Path) (Entry, error)

func (RootEntry) PathName

func (s RootEntry) PathName() string

PathName returns the name of the Entry

func (*RootEntry) RemoveExplicitDeletes added in v0.0.63

func (r *RootEntry) RemoveExplicitDeletes(intentName string) *sdcpb.PathSet

func (RootEntry) SdcpbPath

func (s RootEntry) SdcpbPath() *sdcpb.Path

SdcpbPath returns the sdcpb.Path, with its elements and keys based on the local schema

func (*RootEntry) String

func (r *RootEntry) String() string

String returns the string representation of the Tree.

func (RootEntry) StringIndent

func (s RootEntry) StringIndent(result []string) []string

StringIndent returns the sharedEntryAttributes in its string representation The string is intented according to the nesting level in the yang model

func (RootEntry) ToJson added in v0.0.44

func (s RootEntry) ToJson(onlyNewOrUpdated bool) (any, error)

func (RootEntry) ToJsonIETF added in v0.0.44

func (s RootEntry) ToJsonIETF(onlyNewOrUpdated bool) (any, error)

func (*RootEntry) ToProtoDeletes added in v0.0.44

func (r *RootEntry) ToProtoDeletes(ctx context.Context) ([]*sdcpb.Path, error)

func (*RootEntry) ToProtoUpdates added in v0.0.44

func (r *RootEntry) ToProtoUpdates(ctx context.Context, onlyNewOrUpdated bool) ([]*sdcpb.Update, error)

func (RootEntry) ToXML added in v0.0.44

func (s RootEntry) ToXML(onlyNewOrUpdated, honorNamespace, operationWithNamespace, useOperationRemove bool) (*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) TreeExport added in v0.0.56

func (r *RootEntry) TreeExport(owner string, priority int32, deviation bool) (*tree_persist.Intent, error)

func (*RootEntry) Validate

func (RootEntry) Walk

func (s RootEntry) Walk(ctx context.Context, v EntryVisitor) error

Walk takes the EntryVisitor and applies it to every Entry in the tree

type TreeContext

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

func NewTreeContext

func NewTreeContext(sc schemaClient.SchemaClientBound, actualOwner string) *TreeContext

func (*TreeContext) GetActualOwner

func (t *TreeContext) GetActualOwner() string

func (*TreeContext) SetActualOwner added in v0.0.54

func (t *TreeContext) SetActualOwner(owner string)

func (*TreeContext) SetRoot

func (t *TreeContext) SetRoot(e Entry) error

Directories

Path Synopsis
xml

Jump to

Keyboard shortcuts

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