sink

package
v0.0.0-...-a152536 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package sink delivers a rendered relay to a configured target — an apprise notification (through the swappable Notifier seam) or a generic HTTP request. Each sink applies a bounded retry policy (transport/timeout/5xx, exponential backoff with full jitter, capped by the request deadline; never a 4xx). Fan-out across a route's target list is the caller's job.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Permanent

func Permanent(err error) error

Permanent wraps err so withRetry stops immediately instead of retrying.

Types

type Message

type Message struct {
	Title       string
	Body        string
	Params      map[string]string // apprise provider params (rendered)
	Headers     map[string]string // http extra headers (rendered route headers)
	ContentType string            // http body content-type
}

Message is the rendered content relayed to a target. A given sink uses the fields relevant to its kind: apprise uses Title/Body/Params; http uses Body/Headers/ContentType.

type Notifier

type Notifier interface {
	Send(ctx context.Context, targetURL, body, title string, params map[string]string) error
}

Notifier is the notification backend seam: apprise-go today, a Go-native or sidecar backend tomorrow, as a one-file swap. The route's params are merged into the target URL's query by the implementation.

func DefaultNotifier

func DefaultNotifier() Notifier

DefaultNotifier returns the apprise-go-backed Notifier.

type Options

type Options struct {
	Notifier       Notifier // apprise backend; DefaultNotifier() when nil
	DefaultRetry   RetryPolicy
	DefaultTimeout time.Duration // http per-target timeout when the target sets none
}

Options carry the cross-cutting defaults and the injected Notifier.

type RetryPolicy

type RetryPolicy struct {
	Attempts int           // total tries (>= 1)
	Backoff  time.Duration // base for exponential backoff + jitter
}

RetryPolicy bounds a target's send attempts.

type Sink

type Sink interface {
	Send(ctx context.Context, msg Message) error
	Name() string
	Kind() string
}

Sink delivers a Message to one target, with retry.

func New

func New(name string, t *config.Target, opts Options) (Sink, error)

New builds the sink for a target. The target is assumed valid (config.Validate ran), i.e. exactly one of apprise/http is set.

Jump to

Keyboard shortcuts

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