tag

Per-entity sync adapter for tag definitions.

This adapter handles the tag DEFINITION rows from the tags table — one file per tag at tag/<id>.yaml. Tag attachments (the entity_tags join rows) are embedded in their parent entity files per ADR-0016, not synced through this module.

struct TagFile

source

struct TagFile

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

Field Type Description
deleted_at Option<DateTime<Utc>> Tombstone instant; when set, import deletes the tag row instead of upserting it.
id Id Stable tag identifier; also the file’s name stem.
label String The tag’s text, as users type it.

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 tag/*.yaml file under gest_dir into SQLite.

A file with deleted_at set deletes its tag row; any other file is upserted by id.

Parameter Type Description
conn &Connection the open database connection
_project_id &Id unused: tag definitions 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 tag row to tag/<id>.yaml.

Every row in tags is written. Files for tags 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.