Documentation
¶
Overview ¶
Package background provides sdk-internal lifecycle primitives for long-lived background work.
The package intentionally knows nothing about history, knowledge, recall, or telemetry backends. It only fixes the cross-cutting concurrency contract: owners create a cancellable context, start goroutines with Add-before-go ordering, debounce work through owner-loop signals, and classify work item outcomes consistently.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Debouncer ¶
type Debouncer struct {
// contains filtered or unexported fields
}
Debouncer emits one signal after a quiet period.
Reset arms or re-arms the timer. The timer callback only attempts to send on C; long-running work should happen in the owner loop that receives the signal. C has capacity 1, so signals coalesce when the owner is busy.
func NewDebouncer ¶
NewDebouncer creates a Debouncer. Non-positive delays are normalized to 1ns so Reset still schedules work asynchronously through the timer path.
func (*Debouncer) C ¶
func (d *Debouncer) C() <-chan struct{}
C returns the signal channel consumed by the owner loop.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group owns a lifecycle-bound context and a set of goroutines derived from it.
Close is idempotent. It cancels the group context, waits for every accepted goroutine to return, and then closes Done. Start synchronizes wg.Add before launching the goroutine, so callers cannot race Close's Wait with a late Add.
func NewGroup ¶
NewGroup returns a fresh lifecycle group. A nil parent is treated as context.Background().
func (*Group) Close ¶
func (g *Group) Close()
Close cancels the group context and waits for all accepted work to drain.