Expand description
Lifecycle for the database’s background tasks.
Auto-flush, auto-compact and the sync loop all outlive the call that starts them. Left detached, nothing can stop them: the host tears its async runtime down while a task is still polling, and on a native runtime that lands the process somewhere it cannot recover from.
Every such task is registered here with a stop signal and a handle. Shutdown
is cooperative first: the signal is set, each task leaves its loop at a point
it chose, and only a task that ignores the signal past
TASK_STOP_TIMEOUT is aborted. Cancelling a database task at an arbitrary
await point can drop it mid-write, so abort is the backstop, never the
mechanism.
Structs§
- Stop
Signal - The stop side of a task’s signal, held by the task itself.
- Task
Registry - The database’s set of running background tasks.
Enums§
- Task
Kind - Which background task a registration belongs to.
Constants§
- TASK_
STOP_ TIMEOUT - How long shutdown waits for a task to leave its loop before aborting it.