task
- Task definitions live at
task/<id>.yamlwith their tags embedded as atags: […]field at the top level (per ADR-0016 §3, “Embedding vs. per-edge files”). - Task notes are individual files at
task/notes/<note_id>.yaml. Each note carries anentity_idreferencing its parent task.
struct TaskFile
struct TaskFileOn-disk wrapper for .gest/task/<id>.yaml.
| Field | Type | Description |
|---|---|---|
deleted_at |
Option<DateTime<Utc>> | When the task was deleted; a set value makes the file a tombstone, and import deletes the row. |
id |
Id | The task’s id, which also names the file. |
title |
String | The task’s title. |
status |
String | The task’s status, as the text stored in the status column. |
priority |
Option<u8> | The task’s priority number, if it has one. |
assigned_to |
Option<Id> | The id of the author the task is assigned to, if any. |
description |
String | The task’s description; left out of the file when empty. |
tags |
Vec<String> | The labels of the task’s tags; left out of the file when empty. |
metadata |
Value | The task’s JSON metadata; left out of the file when null. |
created_at |
DateTime<Utc> | When the task was created. |
updated_at |
DateTime<Utc> | When the task was last changed. |
resolved_at |
Option<DateTime<Utc>> | When the task reached a terminal status, or None while it is not done or cancelled. |
Implements Clone, Debug, Deserialize<'de>, Eq, PartialEq, Serialize.
struct TaskNoteFile
struct TaskNoteFileOn-disk wrapper for .gest/task/notes/<note_id>.yaml.
| Field | Type | Description |
|---|---|---|
deleted_at |
Option<DateTime<Utc>> | When the note was deleted; a set value makes the file a tombstone, and import deletes the row. |
id |
Id | The note’s id, which also names the file. |
entity_id |
Id | The id of the task that the note belongs to. |
author_id |
Option<Id> | The author who wrote the note, if one is recorded. |
body |
String | The note’s text. |
created_at |
DateTime<Utc> | When the note was created. |
updated_at |
DateTime<Utc> | When the note was last changed. |
Implements Clone, Debug, Deserialize<'de>, Eq, PartialEq, Serialize.
fn read_all
pub async fn read_all(conn: &Connection, project_id: &Id, gest_dir: &Path) -> Result<(), Error>Import every task/*.yaml (and task/notes/*.yaml) file into SQLite.
A tombstoned file deletes its row; any other file inserts or updates its row. A task’s tags are replaced by the labels in its file.
| Parameter | Type | Description |
|---|---|---|
conn |
&Connection | the database connection |
project_id |
&Id | the project that imported tasks belong to |
gest_dir |
&Path | the project’s .gest/ directory |
| returns | Result<(), Error> | Ok(()) when every file is imported, or an error when a file cannot be read or parsed or a query fails. |
fn write_all
pub async fn write_all(conn: &Connection, project_id: &Id, gest_dir: &Path) -> Result<(), Error>Export every task and task note row to per-entity files.
Afterwards it removes the files of tasks and notes that are no longer in the database, and their digests. Tombstoned task and note files stay, because clones read them as the delete signal.
| Parameter | Type | Description |
|---|---|---|
conn |
&Connection | the database connection |
project_id |
&Id | the project whose tasks to export |
gest_dir |
&Path | the project’s .gest/ directory |
| returns | Result<(), Error> | Ok(()) when every row is written, or an error when a query, an id, a timestamp or a file write fails. |
fn load_task_tag_labels
async fn load_task_tag_labels(conn: &Connection, task_id: &Id) -> Result<Vec<String>, Error>Read the labels of the tags attached to a task.
| Parameter | Type | Description |
|---|---|---|
conn |
&Connection | the database connection |
task_id |
&Id | the task whose tags to read |
| returns | Result<Vec<String>, Error> | The labels in alphabetical order, or an error when the query fails. |
fn parse_dt
fn parse_dt(s: &str) -> Result<DateTime<Utc>, Error>Parse an RFC 3339 timestamp from the database into UTC.
| Parameter | Type | Description |
|---|---|---|
s |
&str | the timestamp text |
| returns | Result<DateTime<Utc>, Error> | The time in UTC, or an Error::Io that holds the parse error. |
fn upsert_note
async fn upsert_note(conn: &Connection, file: &TaskNoteFile) -> Result<(), Error>Insert a task note row from its file, or update the body and updated_at of the row that has its id.
| Parameter | Type | Description |
|---|---|---|
conn |
&Connection | the database connection |
file |
&TaskNoteFile | the parsed note file |
| returns | Result<(), Error> | Ok(()) when the row is written, or an error when the query fails. |
fn upsert_task
async fn upsert_task(conn: &Connection, project_id: &Id, file: &TaskFile) -> Result<(), Error>Insert a task row from its file, or update the row that has its id.
An update changes every column from the file except the project and created_at.
| Parameter | Type | Description |
|---|---|---|
conn |
&Connection | the database connection |
project_id |
&Id | the project that a new row belongs to |
file |
&TaskFile | the parsed task file |
| returns | Result<(), Error> | Ok(()) when the row is written, or an error when the query fails. |