Documentation
¶
Overview ¶
Package eventsink implements the optional webhook notification layer for BubbleFish Nexus. It tails the write path via a lossy buffered channel and delivers event payloads to configured HTTP sinks with per-sink exponential backoff retry.
INVARIANT: The event sink NEVER blocks the write path. The channel is lossy by design — if the channel is full, events are dropped and a metric is incremented.
Reference: Tech Spec Section 10.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
MaxInFlight int
RetryBackoffSeconds []int
Sinks []SinkConfig
Metrics Metrics
Logger *slog.Logger
}
Config holds the Sink configuration.
type Event ¶
type Event struct {
EventType string `json:"event_type"`
PayloadID string `json:"payload_id"`
Source string `json:"source"`
Subject string `json:"subject"`
Destination string `json:"destination"`
Timestamp time.Time `json:"timestamp"`
ActorType string `json:"actor_type"`
ActorID string `json:"actor_id"`
Content json.RawMessage `json:"content,omitempty"` // only when sink content="full"
}
Event is the payload sent to webhook sinks after a successful WAL append. Reference: Tech Spec Section 10.2.
type Metrics ¶
type Metrics interface {
IncDropped()
IncDelivered()
IncFailed()
}
Metrics is the interface for event sink Prometheus counters.
type Sink ¶
type Sink struct {
// contains filtered or unexported fields
}
Sink is the event sink engine. Call Emit from the write path (non-blocking). Call Stop during shutdown to drain pending events.
func (*Sink) Emit ¶
Emit sends an event to the sink channel. It NEVER blocks — if the channel is full, the event is dropped and bubblefish_events_dropped_total is incremented.
INVARIANT: This function is called on the write hot path. It must be non-blocking. Reference: Tech Spec Section 10.1.