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 ¶
- type Base
- func (m *Base) AddService(name string, register func(*grpc.Server))
- func (m *Base) Agent() *ffi.Agent
- func (m *Base) Close() error
- func (m *Base) Endpoint() string
- func (m *Base) Log() *zap.Logger
- func (m *Base) Name() string
- func (m *Base) RegisterService(server *grpc.Server)
- func (m *Base) ServicesNames() []string
- type BaseConfig
- type Option
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 ¶
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 ¶
AddService registers one gRPC service of the module.
It is called from the module constructor only.
func (*Base) Endpoint ¶
Endpoint returns the address the module's services bind when run in a separate process. Inside the gateway process it is ignored.
func (*Base) RegisterService ¶
RegisterService registers every service of the module on the server.
func (*Base) ServicesNames ¶
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.