app

package
v0.0.0-...-57d2186 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrokerApp

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

BrokerApp wires together the broker, offset store, transport, and pluggable balancer/scheduler. It is the single reusable entry point used by cmd/broker, experiments, and tests.

func New

func New(cfg broker.Config, dataDir string, opts ...Option) (*BrokerApp, error)

New creates a BrokerApp. Call Start() to begin serving.

func (*BrokerApp) Addr

func (a *BrokerApp) Addr() string

Addr returns the gRPC listen address, or empty string if gRPC is not enabled.

func (*BrokerApp) Broker

func (a *BrokerApp) Broker() *broker.Broker

Broker returns the underlying broker for direct in-process access.

func (*BrokerApp) HTTPAddr

func (a *BrokerApp) HTTPAddr() string

HTTPAddr returns the HTTP listen address, or empty string if HTTP is not enabled.

func (*BrokerApp) Start

func (a *BrokerApp) Start() error

Start begins the broker loops and optionally starts the gRPC server.

func (*BrokerApp) Stop

func (a *BrokerApp) Stop()

Stop gracefully shuts down all components.

type Option

type Option func(*BrokerApp)

Option configures a BrokerApp before it starts.

func WithAdmin

func WithAdmin(addr string) Option

WithAdmin enables the admin server (/healthz, /readyz, /debug/pprof/*, /metrics) on a separate port, keeping pprof and diagnostics away from client traffic.

func WithBackpressure

func WithBackpressure(threshold float64, horizon int) Option

WithBackpressure enables predictive backpressure control. threshold is the load level at which producers are throttled (default 0.85). horizon is how many steps ahead to look in the prediction (default 3).

func WithBalancer

func WithBalancer(b broker.Balancer) Option

WithBalancer sets the partition balancer (default: RoundRobin).

func WithBalancerFactory

func WithBalancerFactory(fn func() broker.Balancer) Option

WithBalancerFactory sets a factory that creates the balancer lazily.

func WithDefaultBalancer

func WithDefaultBalancer() Option

func WithGRPC

func WithGRPC(addr string) Option

func WithHTTP

func WithHTTP(addr string) Option

func WithLassoPilot

func WithLassoPilot(pilot ...optimizer.PilotData) Option

WithLassoPilot provides pilot-run data for Lasso-based parameter selection. When set, DDPG tunes only the subset of parameters that Lasso identifies as significant at the given alpha. Must be called after WithOptimizer.

func WithLoadPredictor

func WithLoadPredictor(window, horizon int, interval time.Duration) Option

WithLoadPredictor enables the AR(p) load predictor that feeds predicted partition loads into the DQN balancer and backpressure controller.

func WithMetricsInterval

func WithMetricsInterval(d time.Duration) Option

WithMetricsInterval sets how often the broker collects metrics and pushes them to the balancer/scheduler (default 100ms).

func WithOptimizer

func WithOptimizer(params []optimizer.TunableParam, optCfg ...optimizer.OptimizerConfig) Option

WithOptimizer enables the TD3 auto-configuration loop that tunes broker parameters online based on live metrics.

func WithP2CBalancer

func WithP2CBalancer(opts ...balancer.P2COption) Option

func WithRoundRobinBalancer

func WithRoundRobinBalancer(opts ...balancer.RROption) Option

func WithScheduler

func WithScheduler(topic string, s broker.Scheduler) Option

Jump to

Keyboard shortcuts

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