trench

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConduitWatcher

func NewConduitWatcher(ctx context.Context, configurationManagerClient nspAPI.ConfigurationManagerClient, trenchName string, trenchWatchers []TrenchWatcher)

func SetConduits added in v1.0.1

func SetConduits(ctx context.Context, tw TrenchWatcher, currentConduits map[string]struct{}, newConduits []*nspAPI.Conduit)

SetConduits adds or removes the conduit in the trenchWatcher based on the differences between currentConduits and newConduits

Types

type Trench

type Trench struct {
	types.Prefix
	Store         types.Storage
	PrefixLengths *types.PrefixLengths
}

func New

func New(ctx context.Context, prefix types.Prefix, store types.Storage, prefixLengths *types.PrefixLengths) (*Trench, error)

New is the constructor for the Trench struct The constructor registers the trench to the store if not already registered in. prefix - prefix of the Trench store - storage for the prefix and its childs (conduit) prefixLengths - prefix length used to allocate the childs (conduit)

func (*Trench) AddConduit

func (t *Trench) AddConduit(ctx context.Context, name string) (types.Conduit, error)

AddConduit returns the conduit with the name in parameter and with as parent the current trench. If not existing, a new one will be created and returned.

func (*Trench) GetConduit

func (t *Trench) GetConduit(ctx context.Context, name string) (types.Conduit, error)

GetNode returns the node with the name in parameter and with as parent the current conduit. If not existing, a nil value is returned.

func (*Trench) RemoveConduit

func (t *Trench) RemoveConduit(ctx context.Context, name string) error

RemoveConduit removes the conduit with the name in parameter and with as parent the current node. no error is returned if the conduit does not exist.

type TrenchWatcher

type TrenchWatcher interface {
	AddConduit(ctx context.Context, name string) (types.Conduit, error)
	RemoveConduit(ctx context.Context, name string) error
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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