operatorlog

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package operatorlog emits the owner-facing operator event feed. It turns typed domain.OperatorEvent values into durable send_dm actions targeting the dedicated EVENT_LOG_CHAT_ID, sharing the caller's transaction so a built event is atomic with the domain change that caused it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Outbox

type Outbox interface {
	Enqueue(
		ctx context.Context,
		input store.AccessActionInput,
	) (domain.AccessAction, bool, error)
}

Outbox is the durable action surface the writer enqueues into. It is satisfied by *store.Outbox and by the engine/admission outbox interfaces, so the writer always rides the caller's transaction-bound outbox.

type Renderer

type Renderer func(domain.OperatorEvent) (string, error)

Renderer turns a typed operator event into owner-facing HTML. A render failure is treated as a feed-build error: the event is skipped, never rolling back the domain change.

type Writer

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

Writer emits operator events to the dedicated event-log chat.

func New

func New(eventLogChatID int64, render Renderer, logger *slog.Logger) *Writer

New returns a writer that targets eventLogChatID. render must be a leaf renderer (typically messages.RenderOperatorEvent) so this package never imports message templates transitively into a cycle.

func (*Writer) ChatID

func (w *Writer) ChatID() int64

ChatID is the configured event-log chat the writer targets.

func (*Writer) Emit

func (w *Writer) Emit(
	ctx context.Context,
	outbox Outbox,
	ev domain.OperatorEvent,
) error

Emit renders ev and enqueues a durable send_dm to the event-log chat using the caller's transaction-bound outbox.

Two failure classes are handled differently (see the event-log spec):

  • a render/build failure is logged and the event is skipped; the domain change is NOT rolled back (observability never gates access-control);
  • a persistence (enqueue) failure propagates so the transaction fails like any other durable write.

A nil writer or outbox is a no-op, so callers can wire the feed optionally.

Jump to

Keyboard shortcuts

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