author

Per-entity sync adapter for authors.

Authors live in the global authors table (no project_id column), but every project mirrors the full author set into its .gest/author/ directory so a fresh checkout can resolve every author referenced by tasks, notes, and events.

struct AuthorFile

source

struct AuthorFile

On-disk wrapper for .gest/author/<id>.yaml.

Field Type Description
deleted_at Option<DateTime<Utc>> Tombstone instant; when set, import deletes the author row instead of upserting it.
id Id Stable author identifier; also the file’s name stem.
name String Display name of the author.
email Option<String> Email address, if the author has one; omitted from the file when absent.
author_type AuthorType Whether the author is a human or an agent.
created_at DateTime<Utc> When the author was first recorded.
updated_at DateTime<Utc> When the author row was last modified.

Implements Clone, Debug, Deserialize<'de>, Eq, PartialEq, Serialize.

fn read_all

source

pub async fn read_all(conn: &Connection, _project_id: &Id, gest_dir: &Path) -> Result<(), Error>

Import every author/*.yaml file under gest_dir into SQLite.

A file with deleted_at set deletes its author row; any other file is upserted.

Parameter Type Description
conn &Connection the open database connection
_project_id &Id unused: authors are global, not scoped to a project
gest_dir &Path the project’s .gest/ directory
returns Result<(), Error> () once every file is imported, or the first read, parse or database error.

fn write_all

source

pub async fn write_all(conn: &Connection, project_id: &Id, gest_dir: &Path) -> Result<(), Error>

Export every author row to author/<id>.yaml.

Authors are global, so every row in authors is written. Files for authors that no longer exist are removed afterwards, except tombstone files.

Parameter Type Description
conn &Connection the open database connection
project_id &Id the project whose sync_digests cache records the writes
gest_dir &Path the project’s .gest/ directory
returns Result<(), Error> () once every file is written and orphans are cleaned up, or the first database, parse or I/O error.

fn upsert

source

async fn upsert(conn: &Connection, file: &AuthorFile) -> Result<(), Error>

Insert an author from its file, or update the existing row with the same id.

On conflict every column but created_at is overwritten.

Parameter Type Description
conn &Connection the open database connection
file &AuthorFile the parsed author file
returns Result<(), Error> () on success, or the database error.