observation

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package observation provides internal fan-out plumbing without depending on the queue package's public event model.

Index

Constants

View Source
const EventSchemaVersion = 1

EventSchemaVersion identifies the canonical observer event envelope emitted by queue, worker, and workflow layers.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sink

type Sink[T any] struct {
	// contains filtered or unexported fields
}

Sink fans one typed value out to observers that may be added during runtime construction.

func NewSink

func NewSink[T any](observers ...func(context.Context, T)) *Sink[T]

NewSink creates a mutable typed observer sink.

func (*Sink[T]) Add

func (s *Sink[T]) Add(observer func(context.Context, T))

Add appends an observer while preserving registration order for each emitted value.

func (*Sink[T]) HasObservers

func (s *Sink[T]) HasObservers() bool

HasObservers reports whether emitting through the sink can reach an observer.

func (*Sink[T]) Observe

func (s *Sink[T]) Observe(ctx context.Context, value T)

Observe invokes a stable observer snapshot so observers may be added without blocking callbacks.

Jump to

Keyboard shortcuts

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