puntidx

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PuntIdx

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

PuntIdx is type-safe implementation of mapping between punt indexes and names.

func (*PuntIdx) Clear

func (p *PuntIdx) Clear()

Clear removes all punt entries from the cache.

func (*PuntIdx) GetMapping

func (p *PuntIdx) GetMapping() idxvpp.NameToIdxRW

GetMapping returns internal read-only mapping. It is used in tests to inspect the content of the PuntIdx.

func (*PuntIdx) LookupIdx

func (p *PuntIdx) LookupIdx(name string) (idx uint32, metadata *PuntMetadata, exists bool)

LookupIdx looks up previously stored item identified by index in mapping.

func (*PuntIdx) LookupName

func (p *PuntIdx) LookupName(idx uint32) (name string, metadata *PuntMetadata, exists bool)

LookupName looks up previously stored item identified by name in mapping.

func (*PuntIdx) RegisterName

func (p *PuntIdx) RegisterName(name string, idx uint32, ifMeta *PuntMetadata)

RegisterName adds new item into name-to-index mapping.

func (*PuntIdx) UnregisterName

func (p *PuntIdx) UnregisterName(name string) (idx uint32, metadata *PuntMetadata, exists bool)

UnregisterName removes an item identified by name from mapping

func (*PuntIdx) UpdateMetadata

func (p *PuntIdx) UpdateMetadata(name string, metadata *PuntMetadata) (success bool)

UpdateMetadata updates metadata in existing punt entry.

type PuntIndex

type PuntIndex interface {
	// GetMapping returns internal read-only mapping with metadata of type interface{}.
	GetMapping() idxvpp.NameToIdxRW

	// LookupIdx looks up previously stored item identified by index in mapping.
	LookupIdx(name string) (idx uint32, metadata *PuntMetadata, exists bool)

	// LookupName looks up previously stored item identified by name in mapping.
	LookupName(idx uint32) (name string, metadata *PuntMetadata, exists bool)
}

PuntIndex provides read-only access to mapping between punt registrations and punt names

type PuntIndexRW

type PuntIndexRW interface {
	PuntIndex

	// RegisterName adds new item into name-to-index mapping.
	RegisterName(name string, idx uint32, puntMeta *PuntMetadata)

	// UnregisterName removes an item identified by name from mapping
	UnregisterName(name string) (idx uint32, metadata *PuntMetadata, exists bool)

	// UpdateMetadata updates metadata in existing punt entry.
	UpdateMetadata(name string, metadata *PuntMetadata) (success bool)

	// Clear removes all punt entries from the mapping.
	Clear()
}

PuntIndexRW is mapping between software punt indexes and names.

func NewPuntIndex

func NewPuntIndex(mapping idxvpp.NameToIdxRW) PuntIndexRW

NewPuntIndex creates new instance of PuntIndexRW.

type PuntMetadata

type PuntMetadata struct {
	Punt       *punt.Punt
	SocketPath []byte
}

PuntMetadata are custom metadata of the punt configuration

Jump to

Keyboard shortcuts

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