sink

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: Apache-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sink runs configured sinks. CAN sinks push-confirm each message onto the bus; HTTP/TCP sinks broadcast to connected clients, with replay served straight from connector queues (SSE/WS only).

Index

Constants

This section is empty.

Variables

View Source
var ErrSkip = errors.New("sink skipped message")

Functions

This section is empty.

Types

type BroadcastReport

type BroadcastReport struct {
	Accepted       []bool
	RecipientDrops int64
	Err            error
}

type Broadcaster

type Broadcaster interface {
	Broadcast(entries []queue.Entry) BroadcastReport
}

Broadcaster sinks fan out to connected clients without confirmation.

type ConnectorRegistrar

type ConnectorRegistrar interface {
	RegisterConnector(id string, r ReplayReader)
	UnregisterConnector(id string)
}

ConnectorRegistrar lets connectors attach their queue for client replay.

type DataServer

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

DataServer hosts serve-mode sink endpoints with dynamically managed routes.

func NewDataServer

func NewDataServer(addr string, log *slog.Logger) *DataServer

func (*DataServer) Addr

func (d *DataServer) Addr() string

func (*DataServer) RemoveRoute

func (d *DataServer) RemoveRoute(path string)

func (*DataServer) SetRoute

func (d *DataServer) SetRoute(path string, h http.Handler)

func (*DataServer) Start

func (d *DataServer) Start() error

func (*DataServer) Stop

func (d *DataServer) Stop(ctx context.Context) error

Stop cancels all active request contexts (ending SSE/WS streams), then shuts the server down, waiting for handlers up to ctx's deadline.

type DeliveryClass

type DeliveryClass string
const (
	DeliveryConfirmed  DeliveryClass = "confirmed"
	DeliveryResumable  DeliveryClass = "resumable"
	DeliveryBestEffort DeliveryClass = "best_effort"
	DeliveryObserved   DeliveryClass = "observe_only"
)

func DeliveryClassOf

func DeliveryClassOf(r Runtime) DeliveryClass

type DeliveryClassifier

type DeliveryClassifier interface {
	DeliveryClass() DeliveryClass
}

DeliveryClassifier makes the route boundary explicit. Implementations that do not provide it are classified from their Pusher/Broadcaster seam by DeliveryClassOf.

type Pusher

type Pusher interface {
	Push(ctx context.Context, e *msg.Envelope) error
}

Pusher sinks confirm each delivery (CAN). ErrSkip means "cannot carry this message, count it and move on" (e.g. envelope without raw bytes).

type ReplayReader

type ReplayReader interface {
	Read(ctx context.Context, after int64, limit int) ([]queue.Entry, error)
}

ReplayReader is what serve-mode sinks use to replay history for a client.

type Runtime

type Runtime interface {
	ID() string
	Stop()
	State() (string, error)
}

func New

func New(ctx context.Context, cfg model.Sink, mgr *bus.Manager, ds *DataServer, log *slog.Logger, met *metrics.Set) (Runtime, error)

type WirePusher

type WirePusher interface {
	PushWire(ctx context.Context, e *msg.Envelope) error
}

WirePusher preserves the envelope's original N2K source identity and raw payload instead of re-originating it through Beacon's claimed client.

Jump to

Keyboard shortcuts

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