Skip to main content

Module task_chases

Module task_chases 

Source
Expand description

Durable chase log: the newest firing of each rung per subject.

This is what makes “each rung fires once per row per threshold” a fact rather than a hope: the sweep checks here before it speaks. Only the newest firing under a subject’s key is kept, because every reader asks “did it fire at or after T?”, which the newest row answers alone - and a held state re-appends once per cadence window, so without that the table would grow with time rather than with what the board is tracking (one permanently-over row is 288 rows a day at the 5-minute cadence).

Re-exports§

use anyhow::Context; 🔒
use forge_primitives::tasks::ChaseRung; 🔒
use forge_primitives::tasks::TaskChase; 🔒
use forge_primitives::tasks::TaskId; 🔒
use redb::ReadableTable; 🔒
use redb::TableDefinition; 🔒
use super::Db; 🔒

Constants§

TASK_CHASES 🔒

Functions§

append
Append chases, each replacing any older firing of its own subject.
bucket_key 🔒
The key prefix every firing of one (project, row, rung, subject) shares: keys sort by it first, so its rows are one contiguous run and its newest firing is its last.
forget
Forget every firing of one subject: the rung’s state cleared, so the slate resets durably rather than in a process’s memory alone.
list_for_project
project’s fired chases, ordered by row and then by time.
row_key 🔒
The row key for one fired chase: its bucket, then the instant (padded so a lexicographic order is the time order).