console

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package console is the v1 notification adapter (R-230, R-231).

Console-only: a notification is recorded and shown to the recipient the next time they look at Pando. Nothing is sent anywhere, and that is the whole of R-231 rather than a placeholder for it.

The honest consequence, which the product has to state rather than imply: a console-only notification reaches nobody who is not already looking. That is why R-266 says sharing an app sends no message — the tile appearing in the recipient's launcher is the notification, and it is strictly better than a console message, because it is waiting there for someone who has never signed in. An adapter that can reach a person elsewhere is R-232, and LATER.

This adapter exists now so the category is exercised: the interface has an implementation, main registers it, and R-232's SMTP adapter is a new file rather than a new seam.

Package console implements the v1 notification adapter (R-231).

The interface exists so SMTP and hosted senders drop in later without touching core.

Index

Constants

View Source
const Kind = "console"

Kind is the adapter's kind string.

Variables

This section is empty.

Functions

func Info

func Info() api.KindInfo

Info describes this kind of adapter for the forms that configure one (api.KindInfo, R-261).

Types

type Adapter

type Adapter struct {
	notifykit.Unconnected
	// contains filtered or unexported fields
}

Adapter records notifications for display in the console.

func New

func New(sink Sink) *Adapter

New returns an adapter writing to sink.

func (*Adapter) Capabilities

func (a *Adapter) Capabilities() api.NotifyCapabilities

Capabilities: the console reaches the people a notification names.

func (*Adapter) Category

func (a *Adapter) Category() api.Category

func (*Adapter) Configure

func (a *Adapter) Configure(_ context.Context, raw json.RawMessage) error

func (*Adapter) HealthCheck

func (a *Adapter) HealthCheck(context.Context) error

HealthCheck succeeds when there is somewhere to record to.

func (*Adapter) Kind

func (a *Adapter) Kind() string

func (*Adapter) Notify

func (a *Adapter) Notify(ctx context.Context, n api.Notification) error

Notify records the message.

Recipients with no user ID are dropped rather than guessed at. This adapter reaches people inside Pando, and a recipient Pando has no account for is someone it cannot reach — saying so by dropping them is better than recording a notification addressed to nobody, which would look delivered.

type Config

type Config struct {
	// Retain is how long a delivered notification is kept. A console
	// notification that is never read is not a failure worth keeping forever.
	RetainDays int `json:"retain_days,omitempty"`
}

Config is the adapter's configuration.

type Sink

type Sink interface {
	Record(ctx context.Context, n api.Notification, retain time.Duration) error
}

Sink is where a notification is recorded.

An interface so this adapter stores nothing itself: R-027 forbids an adapter touching state, and this is that boundary — main supplies a writer that core owns.

The signature uses only api types on purpose. A struct declared here would have to be imported by whatever implements this, which would make core depend on one specific adapter — the dependency running backwards, past the boundary the lint is guarding, in a direction the lint does not check.

Jump to

Keyboard shortcuts

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