Skip to main content

hypha/cache/
mod.rs

1//! Cache management for downloaded spores and domain metadata.
2//!
3//! Cache location: `$CMN_HOME/hypha/cache/`
4//!
5//! Cache structure:
6//! ```text
7//! $CMN_HOME/hypha/cache/
8//! └── {domain}/
9//!     ├── mycelium/
10//!     │   ├── cmn.json             # cached cmn.json entry
11//!     │   ├── domain_state.json    # anti-rollback serial/digest/key pin
12//!     │   ├── mycelium.json       # full mycelium manifest
13//!     │   └── status.json         # cache status for all items
14//!     │
15//!     ├── repos/                  # Bare git repositories for spawn/pull
16//!     │   └── {root_commit}/      # Repository identified by first commit SHA
17//!     │
18//!     └── spore/
19//!         └── {hash}/
20//!             ├── spore.json
21//!             └── content/
22//! ```
23
24mod commands;
25mod dir;
26mod domain;
27mod fs;
28mod types;
29
30pub use commands::{handle_clean, handle_list, handle_path};
31pub use dir::CacheDir;
32pub use domain::{DomainCache, DOMAIN_STATE_JUMP_THRESHOLD};
33pub use types::{
34    CacheStatus, CachedSpore, DomainStatePin, FetchStatus, KeyTrustEntry, TasteVerdictCache,
35};
36
37use crate::config::HyphaConfig;
38use fs::{dir_size, locked_update_file, locked_write_file, read_spore_metadata};
39
40#[cfg(test)]
41mod tests;