modulebase

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package modulebase carries the skeleton every built-in module and device control plane shares: the attachment to the shared-memory agent, the gateway service surface and the close.

A module embeds a Base, registers its gRPC services in its constructor and keeps its extras — interceptors, background work, extra close steps — beside it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

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

Base is the shared skeleton of a built-in control plane: the attachment to the shared-memory agent, the gateway service methods and the close.

Services are added from the module constructor alone, before the gateway reads the surface, so nothing guards the list.

func NewBase

func NewBase(cfg ffi.AttachConfig, name, endpoint string, options ...Option) (*Base, error)

NewBase attaches to the shared-memory agent under the module's type name.

The returned base carries a logger scoped to the module.

func (*Base) AddService

func (m *Base) AddService(name string, register func(*grpc.Server))

AddService registers one gRPC service of the module.

It is called from the module constructor only.

func (*Base) Agent

func (m *Base) Agent() *ffi.Agent

Agent returns the shared-memory agent the module publishes through.

func (*Base) Close

func (m *Base) Close() error

Close releases the shared-memory attachment.

func (*Base) Endpoint

func (m *Base) Endpoint() string

Endpoint returns the address the module's services bind when run in a separate process. Inside the gateway process it is ignored.

func (*Base) Log

func (m *Base) Log() *zap.Logger

Log returns the logger scoped to the module.

func (*Base) Name

func (m *Base) Name() string

Name returns the module's shared-memory type name.

func (*Base) RegisterService

func (m *Base) RegisterService(server *grpc.Server)

RegisterService registers every service of the module on the server.

func (*Base) ServicesNames

func (m *Base) ServicesNames() []string

ServicesNames returns the fully-qualified names of the module's gRPC services.

type BaseConfig

type BaseConfig struct {
	ffi.AttachConfig `yaml:",inline"`

	// Endpoint is the gRPC endpoint address.
	Endpoint xcfg.NonEmptyString `yaml:"endpoint"`
}

BaseConfig is the shared configuration document of a module or device control plane: which dataplane instance its agent serves and where its gRPC endpoint binds.

A module embeds it inline, so the keys sit at the top level of the module's own document, and adds its module-specific fields beside it.

func NewBaseConfig

func NewBaseConfig(memory datasize.ByteSize) BaseConfig

NewBaseConfig returns the shared defaults for an agent arena of the given size.

type Option

type Option func(*options)

Option configures the Base constructor.

func WithLog

func WithLog(log *zap.Logger) Option

WithLog sets the logger of the base.

Jump to

Keyboard shortcuts

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