types

package
v0.22.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delivery

type Delivery interface {
	Dispatch(ctx context.Context, n Payload, receivers []*Receiver) error
}

Delivery sends notifications to receivers.

type DeliveryResult

type DeliveryResult struct {
	Status     string // Target-specific status (e.g., HTTP status).
	StatusCode int    // Numeric status code when available.
	Response   string // Target-specific response summary/body.
}

DeliveryResult captures target response details for history.

type HeartbeatMeta

type HeartbeatMeta struct {
	Title     string        // Heartbeat title.
	Interval  time.Duration // Expected heartbeat interval.
	LateAfter time.Duration // Late window duration.
}

HeartbeatMeta provides heartbeat context for rendering.

type HeartbeatRegistry

type HeartbeatRegistry interface {
	RegisterHeartbeat(heartbeatID string, meta HeartbeatMeta)
}

HeartbeatRegistry registers heartbeat metadata for dispatch.

type Notification

type Notification interface {
	HeartbeatID() string
	Status() string
	Payload() string
	Since() time.Duration
	Timestamp() time.Time
	ReceiverNames() []string
}

Notification describes a notification payload and routing info.

type Notifier

type Notifier interface {
	Enqueue(n Notification) string
}

Notifier enqueues notifications for delivery.

type Payload

type Payload struct {
	HeartbeatID string        // Heartbeat identifier.
	Title       string        // Heartbeat title.
	Status      string        // Status identifier.
	Payload     string        // Raw last payload.
	Timestamp   time.Time     // Event time.
	Interval    time.Duration // Expected heartbeat interval.
	LateAfter   time.Duration // Late window duration.
	Since       time.Duration // Time since last heartbeat.
}

Payload describes a heartbeat event to deliver.

type Receiver

type Receiver struct {
	Name    string         // Receiver name.
	Retry   RetryConfig    // Retry policy.
	Targets []Target       // Delivery targets.
	Vars    map[string]any // Receiver variables.
}

Receiver describes the runtime delivery configuration.

type ReceiverRegistry

type ReceiverRegistry interface {
	Register(heartbeatID string, receivers map[string]*Receiver)
}

ReceiverRegistry registers receivers per heartbeat.

type ResultTarget

type ResultTarget interface {
	SendResult(n Payload) (DeliveryResult, error)
}

ResultTarget returns delivery details for history recording.

type RetryConfig

type RetryConfig struct {
	Count int           // Number of retries.
	Delay time.Duration // Delay between retries.
}

RetryConfig defines retry behavior for a receiver.

type Target

type Target interface {
	Send(n Payload) error
	Type() string
}

Target delivers a notification to a single destination.

type TargetType

type TargetType int

TargetType represents a delivery target kind.

const (
	TargetUnknown TargetType = iota
	TargetWebhook
	TargetEmail
)

func (TargetType) String

func (t TargetType) String() string

String returns the target type identifier.

Jump to

Keyboard shortcuts

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