memory

package
v0.0.0-...-4a05471 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package memory provides in-memory backends for neighbor and route stores.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NeighborIndex

type NeighborIndex map[string]*api.Neighbor

NeighborIndex is a mapping of a neighborID to a Neighbor

type NeighborsBackend

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

NeighborsBackend is an in-memory backend implementation for the neighbors store.

func NewNeighborsBackend

func NewNeighborsBackend() *NeighborsBackend

NewNeighborsBackend instanciates a new in memory neighbors backend.

func (*NeighborsBackend) CountNeighborsAt

func (b *NeighborsBackend) CountNeighborsAt(
	ctx context.Context,
	sourceID string,
) (int, error)

CountNeighborsAt retrievs the number of neighbors at this source.

func (*NeighborsBackend) GetNeighborsAt

func (b *NeighborsBackend) GetNeighborsAt(
	ctx context.Context,
	sourceID string,
) (api.Neighbors, error)

GetNeighborsAt retrieves all neighbors for a source identified by its ID.

func (*NeighborsBackend) GetNeighborsMapAt

func (b *NeighborsBackend) GetNeighborsMapAt(
	ctx context.Context,
	sourceID string,
) (map[string]*api.Neighbor, error)

GetNeighborsMapAt retrieves all neighbors for a source identified by its ID and returns a map.

func (*NeighborsBackend) SetNeighbors

func (b *NeighborsBackend) SetNeighbors(
	ctx context.Context,
	sourceID string,
	neighbors api.Neighbors,
) error

SetNeighbors replaces the current list of neighbors for a given routeserver source.

type RoutesBackend

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

RoutesBackend implements an in memory backend for the routes store.

func NewRoutesBackend

func NewRoutesBackend() *RoutesBackend

NewRoutesBackend creates a new instance

func (*RoutesBackend) CountRoutesAt

func (r *RoutesBackend) CountRoutesAt(
	ctx context.Context,
	sourceID string,
) (uint, uint, error)

CountRoutesAt returns the number of filtered and imported routes and implements the RoutesStoreBackend interface.

func (*RoutesBackend) FindByNeighbors

func (r *RoutesBackend) FindByNeighbors(
	ctx context.Context,
	query []*api.NeighborQuery,
	filters *api.SearchFilters,
) (api.LookupRoutes, error)

FindByNeighbors will return the prefixes for a list of neighbors identified by ID.

func (*RoutesBackend) FindByPrefix

func (r *RoutesBackend) FindByPrefix(
	ctx context.Context,
	prefix string,
	filters *api.SearchFilters,
	limit uint,
) (api.LookupRoutes, error)

FindByPrefix will return the prefixes matching a pattern

func (*RoutesBackend) SetRoutes

func (r *RoutesBackend) SetRoutes(
	ctx context.Context,
	sourceID string,
	routes api.LookupRoutes,
) error

SetRoutes implements the RoutesStoreBackend interface function for setting all routes of a source identified by ID.

Jump to

Keyboard shortcuts

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