local_store/lib.rs
1//! Pure path management and raw file storage crate for application config/data directories.
2//!
3//! `local-store` closes over local storage concerns: platform-agnostic path
4//! resolution, atomic file/dir storage, and format dispatch. It is the storage
5//! foundation of the `version-migrate` workspace, and is usable standalone
6//! when schema versioning is not needed.
7//!
8//! ## Architecture
9//!
10//! - [`paths`] — `AppPaths` / `PrefPath` resolve config and data directories
11//! (`System` / `Xdg` / `CustomBase` strategies).
12//! - [`storage`] — `FileStorage`: single-file storage with atomic writes
13//! (temp file + fsync + rename + parent-directory sync).
14//! - [`dir_storage`] — `DirStorage` / `AsyncDirStorage`: one-file-per-entity
15//! storage with filename encoding (`Direct` / `UrlEncode` / `Base64`).
16//! - [`atomic_io`] — shared low-level atomic-write primitives.
17//! - [`format_convert`] — pure JSON ↔ TOML value conversion.
18//! - [`errors`] — [`StoreError`], the unified error type.
19//!
20//! Content is stored and retrieved as opaque UTF-8 strings; serialization and
21//! schema evolution are the caller's responsibility (see `version-migrate`).
22#![warn(missing_docs)]
23
24pub mod atomic_io;
25pub mod dir_storage;
26pub mod errors;
27pub mod format_convert;
28pub mod paths;
29pub mod storage;
30
31pub use dir_storage::{DirStorage, DirStorageStrategy, FilenameEncoding};
32pub use errors::{IoOperationKind, StoreError};
33pub use format_convert::{json_to_toml, FormatConvertError};
34pub use paths::{AppPaths, PathStrategy, PrefPath};
35pub use storage::{
36 AtomicWriteConfig, FileStorage, FileStorageStrategy, FormatStrategy, LoadBehavior,
37};
38
39#[cfg(feature = "async")]
40pub use dir_storage::AsyncDirStorage;