Documentation
¶
Overview ¶
Package serialqueue is the serial callback goroutine of the facade's `…Async` callbacks: a device's (device) and the node's own (node's OnDiagnosticEventAsync). One type, so both follow one rule.
Index ¶
Constants ¶
const Bound = 1024
Bound is the number of queued callbacks that have not started a queue holds; the one running is not counted.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is a serial goroutine: the `…Async` callbacks run on it, one after the other, in the order they were enqueued. Its owner (ADR 0026 principle 5) starts it and stops it — waiting until every queued callback ran. Enqueue never blocks the goroutine that enqueues; a callback handed to a queue that is not running is dropped. The queue holds at most Bound callbacks that have not started: past it the oldest of them is dropped and counted (Queue.Dropped) and the first drop since the queue last ran empty is logged at warn (`matter.callbacks.dropped`); when the queue runs empty again the episode's count and the queue's total are logged at warn (`matter.callbacks.overflow_ended`), so a host callback slower than the events behind it costs those events, not unbounded memory. A callback must not stop its own queue's owner: the stop would wait for the callback that called it.
func (*Queue) CountIn ¶ added in v0.11.0
CountIn makes every callback enqueued from now on count as work of the group group returns at its Enqueue, until it returned: a fabrictest site does not move its clock while a host callback waits or runs. group may return nil (no group: nothing is counted).
func (*Queue) Enqueue ¶
func (q *Queue) Enqueue(fn func())
Enqueue queues fn; a no-op for nil or while the queue does not run.
func (*Queue) SetLogger ¶
SetLogger sets the logger of the queue's warnings; nil logs through slog.Default().