Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher serializes callback invocations onto a single goroutine so callers can safely re-enter the API from inside a callback without deadlocking against locks held by the goroutine that produced the event.
func NewDispatcher ¶
func NewDispatcher(bufSize int, log *slog.Logger) *Dispatcher
func (*Dispatcher) Close ¶
func (d *Dispatcher) Close()
Close stops the dispatcher and waits for the loop goroutine to drain any pending events.
func (*Dispatcher) Submit ¶
func (d *Dispatcher) Submit(fn func())
Submit enqueues fn for execution on the dispatcher goroutine. If the queue is full, the oldest queued event is dropped to make room for the new one; this prevents a slow user callback from stalling producers. Submit never blocks.
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer is a fixed-capacity byte ring used to capture the tail of a stream (e.g. ffmpeg stderr) without growing without bound.
func NewRingBuffer ¶
func NewRingBuffer(capacity int) *RingBuffer
func (*RingBuffer) Snapshot ¶
func (r *RingBuffer) Snapshot() []byte
Snapshot returns a copy of the buffered tail bytes in order.