Documentation
¶
Index ¶
- type Backend
- type Config
- type DecapModule
- type DecapService
- func (m *DecapService) DeleteConfig(ctx context.Context, req *decappb.DeleteConfigRequest) (*decappb.DeleteConfigResponse, error)
- func (m *DecapService) ListConfigs(ctx context.Context, req *decappb.ListConfigsRequest) (*decappb.ListConfigsResponse, error)
- func (m *DecapService) ReclaimDeferred()
- func (m *DecapService) ShowConfig(ctx context.Context, req *decappb.ShowConfigRequest) (*decappb.ShowConfigResponse, error)
- func (m *DecapService) UpdateConfig(ctx context.Context, req *decappb.UpdateConfigRequest) (*decappb.UpdateConfigResponse, error)
- type ModuleHandle
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
// UpdateModule creates a module config, adds prefixes, and publishes
// it to the dataplane.
UpdateModule(name string, prefixes []netip.Prefix) (ModuleHandle, error)
// DeleteModule removes a module config.
DeleteModule(name string) error
}
Backend abstracts shared memory operations.
func NewBackend ¶
NewBackend creates a Backend that operates on real shared memory.
type Config ¶
type Config struct {
// InstanceID specifies which dataplane instance this module serves.
//
// Required: a listed module must set it explicitly, even to 0.
InstanceID xcfg.Required[uint32] `yaml:"instance_id"`
// MemoryPath is the path to the shared-memory file that is used to
// communicate with dataplane.
MemoryPath xcfg.NonEmptyString `yaml:"memory_path"`
// MemoryRequirements is the amount of memory that is required for a single
// transaction.
MemoryRequirements xcfg.NonZero[datasize.ByteSize] `yaml:"memory_requirements"`
Endpoint xcfg.NonEmptyString `yaml:"endpoint"`
}
func DefaultConfig ¶
func DefaultConfig() *Config
type DecapModule ¶
type DecapModule struct {
// contains filtered or unexported fields
}
DecapModule is a control-plane component of a module that is responsible for decapsulating various kinds of tunnels.
func NewDecapModule ¶
func NewDecapModule(cfg *Config, options ...Option) (*DecapModule, error)
func (*DecapModule) Endpoint ¶
func (m *DecapModule) Endpoint() string
func (*DecapModule) Name ¶
func (m *DecapModule) Name() string
func (*DecapModule) RegisterService ¶
func (m *DecapModule) RegisterService(server *grpc.Server)
func (*DecapModule) ServicesNames ¶
func (m *DecapModule) ServicesNames() []string
type DecapService ¶
type DecapService struct {
decappb.UnimplementedDecapServiceServer
// contains filtered or unexported fields
}
DecapService implements the DecapService gRPC server.
func NewDecapService ¶
func NewDecapService(backend Backend) *DecapService
NewDecapService constructs a DecapService backed by the given Backend.
func (*DecapService) DeleteConfig ¶
func (m *DecapService) DeleteConfig( ctx context.Context, req *decappb.DeleteConfigRequest, ) (*decappb.DeleteConfigResponse, error)
DeleteConfig removes the named config if it is not referenced by any pipeline.
func (*DecapService) ListConfigs ¶
func (m *DecapService) ListConfigs( ctx context.Context, req *decappb.ListConfigsRequest, ) (*decappb.ListConfigsResponse, error)
ListConfigs returns all known config names across all dataplane instances.
func (*DecapService) ReclaimDeferred ¶
func (m *DecapService) ReclaimDeferred()
ReclaimDeferred retries every deferred handle, dropping the ones whose generations have drained and keeping the rest deferred. It is the reclamation handler for this module's superseded configs; the service itself runs it after each successful publish, and anything else may call it at any time.
func (*DecapService) ShowConfig ¶
func (m *DecapService) ShowConfig( ctx context.Context, req *decappb.ShowConfigRequest, ) (*decappb.ShowConfigResponse, error)
ShowConfig returns the current prefix set for the named config.
func (*DecapService) UpdateConfig ¶
func (m *DecapService) UpdateConfig( ctx context.Context, req *decappb.UpdateConfigRequest, ) (*decappb.UpdateConfigResponse, error)
UpdateConfig atomically replaces the whole prefix set of the named config.
type ModuleHandle ¶
type ModuleHandle interface {
Free() error
}
ModuleHandle is a handle to a module configuration.