Skip to main content

Crate local_store

Crate local_store 

Source
Expand description

Pure path management and raw file storage crate for application config/data directories.

local-store closes over local storage concerns: platform-agnostic path resolution, atomic file/dir storage, and format dispatch. It is the storage foundation of the version-migrate workspace, and is usable standalone when schema versioning is not needed.

§Architecture

  • pathsAppPaths / PrefPath resolve config and data directories (System / Xdg / CustomBase strategies).
  • storageFileStorage: single-file storage with atomic writes (temp file + fsync + rename + parent-directory sync).
  • dir_storageDirStorage / AsyncDirStorage: one-file-per-entity storage with filename encoding (Direct / UrlEncode / Base64).
  • atomic_io — shared low-level atomic-write primitives.
  • format_convert — pure JSON ↔ TOML value conversion.
  • errorsStoreError, the unified error type.

Content is stored and retrieved as opaque UTF-8 strings; serialization and schema evolution are the caller’s responsibility (see version-migrate).

Re-exports§

pub use dir_storage::DirStorage;
pub use dir_storage::DirStorageStrategy;
pub use dir_storage::FilenameEncoding;
pub use errors::IoOperationKind;
pub use errors::StoreError;
pub use format_convert::json_to_toml;
pub use format_convert::FormatConvertError;
pub use paths::AppPaths;
pub use paths::PathStrategy;
pub use paths::PrefPath;
pub use storage::AtomicWriteConfig;
pub use storage::FileStorage;
pub use storage::FileStorageStrategy;
pub use storage::FormatStrategy;
pub use storage::LoadBehavior;

Modules§

atomic_io
Atomic file I/O helpers shared across storage types.
dir_storage
Raw directory-based storage for one-file-per-entity persistence.
errors
Error types for local store operations.
format_convert
Format conversion helpers for storage operations.
paths
Platform-agnostic path management for application configuration and data.
storage
Raw file storage with atomic-write guarantees.