Skip to main content

Module tasks

Module tasks 

Source
Expand description

Durable task persistence on the redb tasks table.

The whole Task record is stored as serde-json keyed by its project and id - no field schema on disk, so a type change needs no table migration. Machine-local, like the crons beside it.

Re-exportsยง

use anyhow::Context; ๐Ÿ”’
use forge_primitives::tasks::Estimate; ๐Ÿ”’
use forge_primitives::tasks::LinkKind; ๐Ÿ”’
use forge_primitives::tasks::Task; ๐Ÿ”’
use forge_primitives::tasks::TaskId; ๐Ÿ”’
use forge_primitives::tasks::TaskStatus; ๐Ÿ”’
use forge_primitives::tasks::Waiting; ๐Ÿ”’
use redb::ReadableTable; ๐Ÿ”’
use redb::TableDefinition; ๐Ÿ”’
use super::Db; ๐Ÿ”’

Structsยง

TaskRecord ๐Ÿ”’
The stored shape: Task plus the two spellings earlier versions wrote - artifact as a bare string, and blocked as a status. Reads go through here so a legacy row loads as the record it meant rather than failing the whole set.

Enumsยง

RecordEstimate ๐Ÿ”’
RecordStatus ๐Ÿ”’

Constantsยง

TASKS ๐Ÿ”’

Functionsยง

delete
Delete a task by project and id. Returns whether a record existed.
list
Every persisted task.
row_key ๐Ÿ”’
The row key for a task: its project as well as its id, separated by a NUL a project name cannot carry.
row_key_for ๐Ÿ”’
The row key for a project and id, the pair row_key joins.
upsert
Persist one task, replacing any prior record for its project and id. One write txn per row, so a write can only touch the row it names.