Documentation
¶
Overview ¶
Package l3b implements L3b module.
Index ¶
- func NewBackendWithSharedMemory(operations SharedMemoryOps) *backend
- func NewSharedMemoryOps(agent *ffi.Agent) agentOps
- func RingFromWeights(weights []uint32) []uint32
- type Backend
- type Config
- type L3BModule
- type L3BService
- func (m *L3BService) CreateService(ctx context.Context, req *l3bpb.CreateServiceRequest) (*l3bpb.CreateServiceResponse, error)
- func (m *L3BService) DeleteService(ctx context.Context, req *l3bpb.DeleteServiceRequest) (*l3bpb.DeleteServiceResponse, error)
- func (m *L3BService) GetService(ctx context.Context, req *l3bpb.GetServiceRequest) (*l3bpb.GetServiceResponse, error)
- func (m *L3BService) ListModuleConfigs(ctx context.Context, req *l3bpb.ListModuleConfigsRequest) (*l3bpb.ListModuleConfigsResponse, error)
- func (m *L3BService) ListServices(ctx context.Context, req *l3bpb.ListServicesRequest) (*l3bpb.ListServicesResponse, error)
- func (m *L3BService) ListSessions(ctx context.Context, req *l3bpb.ListSessionsRequest) (*l3bpb.ListSessionsResponse, error)
- func (m *L3BService) UpdateModuleConfig(ctx context.Context, req *l3bpb.UpdateModuleConfigRequest) (*l3bpb.UpdateModuleConfigResponse, error)
- func (m *L3BService) UpdateRealServerState(ctx context.Context, req *l3bpb.UpdateRealServerStateRequest) (*l3bpb.UpdateRealServerStateResponse, error)
- func (m *L3BService) UpdateRealServerWeight(ctx context.Context, req *l3bpb.UpdateRealServerWeightRequest) (*l3bpb.UpdateRealServerWeightResponse, error)
- func (m *L3BService) UpdateService(ctx context.Context, req *l3bpb.UpdateServiceRequest) (*l3bpb.UpdateServiceResponse, error)
- type ModuleHandle
- type Option
- type SessionTableHandle
- type SharedMemoryOps
- type VirtualServiceHandle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBackendWithSharedMemory ¶ added in v0.2.0
func NewBackendWithSharedMemory(operations SharedMemoryOps) *backend
NewBackendWithSharedMemory serializes writes independently of reads.
func NewSharedMemoryOps ¶ added in v0.2.0
NewSharedMemoryOps preserves C ownership and publication through the agent.
func RingFromWeights ¶
RingFromWeights expands per-server weights into a weighted-round-robin scheduler ring: each server index appears as many times as its weight, but the occurrences are interleaved so a heavy server is spread evenly across the ring rather than clustered.
Types ¶
type Backend ¶
type Backend interface {
// CreateService creates a named virtual service.
CreateService(service *l3bpb.VirtualService) error
// UpdateService replaces an existing named virtual service.
UpdateService(service *l3bpb.VirtualService) error
// DeleteService removes a named virtual service.
DeleteService(name string) error
// ListServices returns the names of all virtual services.
ListServices() []string
// UpdateModuleConfig installs destination filters and services into a
// named module configuration and publishes it.
UpdateModuleConfig(config *l3bpb.ModuleConfig) error
// ListModuleConfigs returns the names of all module configurations.
ListModuleConfigs() []string
// UpdateRealServerState enables or disables a real server within a
// named virtual service.
UpdateRealServerState(service string, realServerIndex uint32, enabled bool) error
// UpdateRealServerWeight sets the weight of a real server within a named
// virtual service and rebuilds its scheduler ring.
UpdateRealServerWeight(service string, realServerIndex uint32, weight uint32) error
// ListSessions pages through the session records of a named virtual
// service. Returns the page, the continuation token (0 when complete)
// and the dataplane time the deadlines are relative to.
ListSessions(
service string,
cursor uint64,
limit uint32,
) ([]cl3bobject.Session, uint64, uint64, error)
// GetService returns an owned snapshot of accepted configuration and state.
//
// Runtime state and weights become visible after the shared-memory call
// returns, including applied changes when a ring rebuild fails.
GetService(service string) (*l3bpb.GetServiceResponse, error)
}
Backend abstracts the shared-memory operations behind the l3b service.
func NewBackend ¶
NewBackend operates on real shared memory through the supplied agent.
type Config ¶
type Config struct {
ffi.AttachConfig `yaml:",inline"`
Endpoint xcfg.NonEmptyString `yaml:"endpoint"`
}
func DefaultConfig ¶
func DefaultConfig() *Config
type L3BModule ¶
type L3BModule struct {
// contains filtered or unexported fields
}
L3BModule is the control-plane component of the l3b module.
func (*L3BModule) RegisterService ¶
func (*L3BModule) ServicesNames ¶
type L3BService ¶
type L3BService struct {
l3bpb.UnimplementedL3BServiceServer
// contains filtered or unexported fields
}
L3BService implements the L3BService gRPC server.
func NewL3BService ¶
func NewL3BService(backend Backend) *L3BService
NewL3BService constructs an L3BService backed by the given Backend.
func (*L3BService) CreateService ¶
func (m *L3BService) CreateService( ctx context.Context, req *l3bpb.CreateServiceRequest, ) (*l3bpb.CreateServiceResponse, error)
CreateService creates a named virtual service.
func (*L3BService) DeleteService ¶
func (m *L3BService) DeleteService( ctx context.Context, req *l3bpb.DeleteServiceRequest, ) (*l3bpb.DeleteServiceResponse, error)
DeleteService removes a named virtual service.
func (*L3BService) GetService ¶
func (m *L3BService) GetService( ctx context.Context, req *l3bpb.GetServiceRequest, ) (*l3bpb.GetServiceResponse, error)
GetService inspects a named virtual service: its scheduler masks and the live real servers with addresses, weights and states.
func (*L3BService) ListModuleConfigs ¶
func (m *L3BService) ListModuleConfigs( ctx context.Context, req *l3bpb.ListModuleConfigsRequest, ) (*l3bpb.ListModuleConfigsResponse, error)
ListModuleConfigs returns the names of all module configurations.
func (*L3BService) ListServices ¶
func (m *L3BService) ListServices( ctx context.Context, req *l3bpb.ListServicesRequest, ) (*l3bpb.ListServicesResponse, error)
ListServices returns the names of all virtual services.
func (*L3BService) ListSessions ¶
func (m *L3BService) ListSessions( ctx context.Context, req *l3bpb.ListSessionsRequest, ) (*l3bpb.ListSessionsResponse, error)
ListSessions pages through the session records of a named virtual service.
func (*L3BService) UpdateModuleConfig ¶
func (m *L3BService) UpdateModuleConfig( ctx context.Context, req *l3bpb.UpdateModuleConfigRequest, ) (*l3bpb.UpdateModuleConfigResponse, error)
UpdateModuleConfig installs destination filters and services into a named module configuration.
func (*L3BService) UpdateRealServerState ¶
func (m *L3BService) UpdateRealServerState( ctx context.Context, req *l3bpb.UpdateRealServerStateRequest, ) (*l3bpb.UpdateRealServerStateResponse, error)
UpdateRealServerState enables or disables a real server within a named virtual service.
func (*L3BService) UpdateRealServerWeight ¶
func (m *L3BService) UpdateRealServerWeight( ctx context.Context, req *l3bpb.UpdateRealServerWeightRequest, ) (*l3bpb.UpdateRealServerWeightResponse, error)
UpdateRealServerWeight sets the weight of a real server within a named virtual service.
func (*L3BService) UpdateService ¶
func (m *L3BService) UpdateService( ctx context.Context, req *l3bpb.UpdateServiceRequest, ) (*l3bpb.UpdateServiceResponse, error)
UpdateService replaces an existing named virtual service.
type ModuleHandle ¶ added in v0.2.0
type ModuleHandle interface {
Free() error
Update([]cl3b.DestinationFilterRule) error
AsFFIModule() ffi.ModuleConfig
}
ModuleHandle is a module configuration owned by the backend.
type SessionTableHandle ¶ added in v0.2.0
type SessionTableHandle interface {
Free() error
}
SessionTableHandle is a session table owned by the backend.
type SharedMemoryOps ¶ added in v0.2.0
type SharedMemoryOps interface {
}
SharedMemoryOps separates allocation and publication from backend bookkeeping.
type VirtualServiceHandle ¶ added in v0.2.0
type VirtualServiceHandle interface {
Free() error
Publish() error
UpdateRing([]uint32) error
SetRealServerState(uint32, bool) error
ReadSessions(uint64, uint32) ([]cl3bobject.Session, uint64, uint64, error)
}
VirtualServiceHandle is a service object owned by the backend.