sync

Import and export between the database and a project’s .gest/ directory. Local sync mirror for .gest/ directories.

When a project is in local mode (has a .gest/ directory), this module handles bidirectional sync between SQLite and the per-entity YAML/markdown files described in ADR-0016. The orchestrator under orchestrator walks every entity adapter under entities in dependency order.

Name Summary
digest Content digest computation and sync_digests cache helpers.
entities Per-entity sync adapters.
orchestrator Top-level coordinator for the per-entity sync layout (ADR-0016).
paths Repo-relative path helpers for the per-entity .gest/ layout (ADR-0016).
tombstone Write-side helpers for tombstoning on-disk entity files.
yaml YAML read/write helpers used by every per-entity sync adapter.

fn import

source

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

Sync state from .gest/ into the database.

Parameter Type Description
conn &Connection the open database connection
project_id &Id the project whose rows are synced
gest_dir &Path the project’s .gest/ directory
returns Result<(), Error> () once every entity adapter has read its files, or the first store error an adapter returns.

fn export

source

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

Sync state from the database out to .gest/.

Parameter Type Description
conn &Connection the open database connection
project_id &Id the project whose rows are synced
gest_dir &Path the project’s .gest/ directory
returns Result<(), Error> () once every entity adapter has written its files, or the first store error an adapter returns.

fn find_gest_dir

source

pub fn find_gest_dir(root: &Path) -> Option<PathBuf>

Find the .gest directory for a project, if it exists.

Parameter Type Description
root &Path the project’s root directory
returns Option<PathBuf> root/.gest when it is a directory, otherwise None.