dispatch

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDelivery

func NewDelivery(
	logger *slog.Logger,
	historyStore history.Recorder,
	metricsReg *metrics.Registry,
) types.Delivery

NewDelivery constructs a Delivery with the provided logger.

Types

type Dispatcher

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

Dispatcher dequeues notifications and delivers them.

func NewDispatcher

func NewDispatcher(
	store *Store,
	mailbox <-chan string,
	delivery types.Delivery,
	registry map[string]map[string]*types.Receiver,
	heartbeats map[string]types.HeartbeatMeta,
	logger *slog.Logger,
) *Dispatcher

NewDispatcher constructs a Dispatcher with the provided mailbox.

func (*Dispatcher) Start

func (d *Dispatcher) Start(ctx context.Context)

Start begins processing notifications until ctx is canceled.

type Manager

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

Manager owns notification delivery infrastructure.

func NewManager

func NewManager(
	logger *slog.Logger,
	historyStore history.Recorder,
	metricsReg *metrics.Registry,
) *Manager

NewManager constructs a notification manager with a buffered mailbox.

func (*Manager) Enqueue

func (m *Manager) Enqueue(n types.Notification) string

Enqueue stores the notification and returns its id.

func (*Manager) Receivers

func (m *Manager) Receivers() []*types.Receiver

Receivers returns the unique receivers registered across all heartbeats.

func (*Manager) Register

func (m *Manager) Register(heartbeatID string, receivers map[string]*types.Receiver)

Register stores receivers for a heartbeat id.

func (*Manager) RegisterHeartbeat

func (m *Manager) RegisterHeartbeat(heartbeatID string, meta types.HeartbeatMeta)

RegisterHeartbeat stores metadata for a heartbeat id.

func (*Manager) ResetRegistries

func (m *Manager) ResetRegistries()

ResetRegistries clears the receiver and heartbeat registries.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context)

Start begins delivery processing.

type Store

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

Store keeps notifications by id.

func NewStore

func NewStore() *Store

NewStore initializes an empty notification store.

func (*Store) Delete

func (s *Store) Delete(id string)

Delete removes a notification by id.

func (*Store) Get

func (s *Store) Get(id string) (types.Notification, bool)

Get returns a notification by id.

func (*Store) Put

func (s *Store) Put(id string, n types.Notification)

Put stores a notification by its id.

Jump to

Keyboard shortcuts

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