Skip to main content

Crate synwire_storage

Crate synwire_storage 

Source
Expand description

Configurable persistent storage layout, project identity, and migration for Synwire.

§Overview

This crate provides three core abstractions:

  • StorageLayout: computes all Synwire storage paths for a given product name, respecting the platform data/cache directory conventions (XDG on Linux, ~/Library/… on macOS, %APPDATA% on Windows).

  • RepoId + WorktreeId: stable two-level project identity. RepoId is derived from the Git first-commit hash (shared across clones and worktrees). WorktreeId further discriminates by worktree root path.

  • StorageMigration: per-subsystem schema version tracking and incremental copy-then-swap migrations.

  • ProjectRegistry: global registry of indexed projects with last-access timestamps and user tags.

§Quick start

use synwire_storage::{StorageLayout, WorktreeId};
use std::path::Path;

let layout = StorageLayout::new("synwire").expect("storage layout");
let worktree = WorktreeId::for_path(Path::new(".")).expect("worktree id");

let index_path = layout.index_cache(&worktree);
println!("Index cache: {}", index_path.display());

Re-exports§

pub use concurrency::atomic_write;
pub use concurrency::ensure_wal_mode;
pub use concurrency::open_wal_database;
pub use dependency_index::DependencyEntry;
pub use dependency_index::DependencyIndex;
pub use dependency_index::DependencyIndexError;
pub use error::StorageError;
pub use identity::RepoId;
pub use identity::WorktreeId;
pub use layout::StorageConfig;
pub use layout::StorageLayout;
pub use migration::MigrationStep;
pub use migration::NoOpMigrationStep;
pub use migration::StorageMigration;
pub use migration::VersionFile;
pub use registry::ProjectRegistry;
pub use registry::RegistryEntry;

Modules§

concurrency
Native concurrency helpers for Synwire storage backends.
dependency_index
Global cross-project dependency index.
error
Error types for the storage layer.
identity
Two-level project identity: RepoId (repository family) and WorktreeId (specific working copy).
layout
Product-scoped persistent storage layout.
migration
Storage schema migration support.
registry
Global project registry.