Documentation ¶
Overview ¶
Package idxvpp2 extends NamedMapping from cn-infra to provide a map between VPP/Linux items with integer handles and northbound string-based identifiers (logical names).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NameToIndex ¶
type NameToIndex interface { // LookupByName retrieves a previously stored item identified by // <name>. If there is no item associated with the give name in the mapping, // the <exists> is returned as *false* and <item> as *nil*. LookupByName(name string) (item WithIndex, exists bool) // LookupByIndex retrieves a previously stored item identified in VPP/Linux // by the given <index>. // If there is no item associated with the given index, <exists> is returned // as *false* with <name> and <item> both set to empty values. LookupByIndex(index uint32) (name string, item WithIndex, exists bool) // WatchItems subscribes to receive notifications about the changes in the // mapping related to items with integer handles. WatchItems(subscriber string, channel chan<- NameToIndexDto) }
NameToIndex is the "user API" to the registry of items with integer handles. It provides read-only access intended for plugins that need to do the conversions between logical names from NB and VPP/Linux item IDs.
type NameToIndexDto ¶
type NameToIndexDto struct { idxmap.NamedMappingEvent Item WithIndex }
NameToIndexDto represents an item sent through watch channel in NameToIndex. In contrast to NamedMappingGenericEvent, it contains item casted to WithIndex.
type NameToIndexRW ¶
type NameToIndexRW interface { NameToIndex idxmap.NamedMappingRW }
NameToIndexRW is the "owner API" to the NameToIndex registry. Using this API the owner is able to add/update and delete associations between logical names and VPP/Linux items identified by integer handles.
func NewNameToIndex ¶
func NewNameToIndex(logger logging.Logger, title string, indexFunction mem.IndexFunction) NameToIndexRW
NewNameToIndex creates a new instance implementing NameToIndexRW. User can optionally extend the secondary indexes through <indexFunction>.