app

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppBuilder

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

AppBuilder constructs the BaseApp components fluently.

func NewAppBuilder

func NewAppBuilder(cfg *config.Config) *AppBuilder

NewAppBuilder creates a new builder.

func (*AppBuilder) Build

func (b *AppBuilder) Build() (*BaseApp, error)

Build finalizes the construction and returns the BaseApp.

func (*AppBuilder) WithKVRuleProcessor

func (b *AppBuilder) WithKVRuleProcessor() *AppBuilder

WithKVRuleProcessor creates a Processor without loading rules from files. Rules are loaded at runtime via KV Watch.

func (*AppBuilder) WithLogger

func (b *AppBuilder) WithLogger() *AppBuilder

WithLogger creates the logger.

func (*AppBuilder) WithMetrics

func (b *AppBuilder) WithMetrics() *AppBuilder

WithMetrics creates the metrics components.

func (*AppBuilder) WithNATSBroker

func (b *AppBuilder) WithNATSBroker() *AppBuilder

WithNATSBroker creates the NATS broker and initializes the KV cache.

type BaseApp

type BaseApp struct {
	Logger        *slog.Logger
	Metrics       *metrics.Metrics
	Broker        *broker.NATSBroker
	Processor     *rule.Processor
	RulesLoader   *rule.RulesLoader
	MetricsServer *http.Server
	Collector     *metrics.MetricsCollector
	// contains filtered or unexported fields
}

BaseApp holds the common, initialized components for any application.

func (*BaseApp) ShutdownMetricsServer

func (base *BaseApp) ShutdownMetricsServer(ctx context.Context) error

ShutdownMetricsServer gracefully shuts down the metrics server and waits for the goroutine to exit.

type RouterApp

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

RouterApp represents the shunt application with all its components including KV support

func NewKVRouterApp

func NewKVRouterApp(base *BaseApp, cfg *config.Config) *RouterApp

NewKVRouterApp creates a shunt application that uses KV Watch for rule management. KV Watch manages subscriptions at runtime.

func (*RouterApp) Close

func (app *RouterApp) Close() error

Close gracefully shuts down all application components

func (*RouterApp) Run

func (app *RouterApp) Run(ctx context.Context) error

Run starts the application and waits for shutdown signal.

func (*RouterApp) SetRuleKVManager

func (app *RouterApp) SetRuleKVManager(mgr *broker.RuleKVManager)

SetRuleKVManager assigns the KV manager that watches for rule changes at runtime.

Jump to

Keyboard shortcuts

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