app

package
v0.0.0-...-db3f45c Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addrs

type Addrs struct {
	GRPC string
}

Addrs stores listener addresses of the router process.

type Agent

type Agent struct {
	GRPCAddress string `env:"AGENT_GRPC_ADDRESS"`
}

Agent stores the configuration for connecting to the Agent over gRPC.

type Config

type Config struct {
	GRPC GRPC

	IngressBufferSize               int    `env:"INGRESS_BUFFER_SIZE"`
	EgressBufferSize                int    `env:"EGRESS_BUFFER_SIZE"`
	UseRFC339                       bool   `env:"USE_RFC339"`
	PProfPort                       uint32 `env:"ROUTER_PPROF_PORT"`
	Agent                           Agent
	MetricBatchIntervalMilliseconds uint   `env:"ROUTER_METRIC_BATCH_INTERVAL_MILLISECONDS"`
	MetricSourceID                  string `env:"ROUTER_METRIC_SOURCE_ID"`
}

Config stores all configurations options for the Router.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig reads from the environment to create a Config.

type GRPC

type GRPC struct {
	Port         uint16   `env:"ROUTER_PORT"`
	CertFile     string   `env:"ROUTER_CERT_FILE"`
	KeyFile      string   `env:"ROUTER_KEY_FILE"`
	CAFile       string   `env:"ROUTER_CA_FILE"`
	CipherSuites []string `env:"ROUTER_CIPHER_SUITES"`
}

GRPC stores the configuration for the router as a server using a PORT with mTLS certs and as a client also using mTSL certs for emitting metrics.

type Router

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

Router routes envelopes from producers to any subscribers.

func NewRouter

func NewRouter(grpc GRPC, opts ...RouterOption) *Router

NewRouter creates a new Router with the given options. Each provided RouterOption will manipulate the Router behavior.

func (*Router) Addrs

func (d *Router) Addrs() Addrs

Addrs returns a copy of the listeners' addresses.

func (*Router) Start

func (d *Router) Start()

Start enables the Router to start receiving envelope, accepting subscriptions and routing data.

func (*Router) Stop

func (d *Router) Stop()

Stop closes the gRPC listeners.

type RouterOption

type RouterOption func(*Router)

RouterOption is used to configure a new Router.

func WithBufferSizes

func WithBufferSizes(
	ingressBufferSize int,
	egressBufferSize int,
) RouterOption

WithBufferSizes returns a routerOption that enables configurable buffer sizes

func WithMetricReporting

func WithMetricReporting(
	agent Agent,
	metricBatchIntervalMilliseconds uint,
	sourceID string,
) RouterOption

WithMetricReporting returns a RouterOption that enables Router to emit metrics about itself.

Jump to

Keyboard shortcuts

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