pub struct CachePaths {Show 14 fields
pub root: PathBuf,
pub images: PathBuf,
pub catalog_db: PathBuf,
pub history_db: PathBuf,
pub log: PathBuf,
pub log_dir: PathBuf,
pub log_file_name: String,
pub socket: PathBuf,
pub pid_file: PathBuf,
pub index_rkyv: PathBuf,
pub replay_dir: PathBuf,
pub cache_db: PathBuf,
pub artifacts_dir: PathBuf,
pub snapshots_dir: PathBuf,
}Expand description
All cache-related paths for the running user.
Fields§
§root: PathBufroot field.
images: PathBufimages field.
catalog_db: PathBufcatalog_db field.
history_db: PathBufhistory_db field.
log: PathBuflog field.
log_dir: PathBuflog_dir field.
log_file_name: Stringlog_file_name field.
socket: PathBufsocket field.
pid_file: PathBufpid_file field.
index_rkyv: PathBufindex_rkyv field.
replay_dir: PathBufreplay/ — per-shell scripts holding the non-deterministic
fragments of .zshrc that the daemon couldn’t bake into canonical
state. Per docs/DAEMON.md “Determinism boundary” (line 278).
cache_db: PathBufcache.db — daemon-as-service KV cache, namespaced. See
docs/DAEMON_AS_SERVICE.md daemon.cache.* ops + daemon/cache.rs.
artifacts_dir: PathBufartifacts/ — content-addressed artifact cache. Files live at
artifacts/<sha256_prefix>/<sha256_hex>. See
docs/DAEMON_AS_SERVICE.md daemon.artifact.* ops.
snapshots_dir: PathBufsnapshots/ — tag-based canonical-state snapshots. See
docs/DAEMON_AS_SERVICE.md daemon.snapshot.* ops.
Implementations§
Source§impl CachePaths
impl CachePaths
Sourcepub fn resolve() -> Result<Self>
pub fn resolve() -> Result<Self>
Resolve to $ZSHRS_HOME or $HOME/.zshrs.
Single top-level directory holds everything: rkyv shards, sqlite
caches, sockets, pid file, logs, AND config
(zshrs.toml, zshrs-daemon.toml, zshrs-recorder.toml).
The directory is NOT cache-semantic — it survives
OS cache eviction; that’s why we don’t use XDG_CACHE_HOME.
Matches the convention of ~/.zinit/, ~/.zpwr/, ~/.oh-my-zsh/.
Override via $ZSHRS_HOME for tests / hermetic harnesses /
users who want a non-default location.
Sourcepub fn with_root<P: Into<PathBuf>>(root: P) -> Self
pub fn with_root<P: Into<PathBuf>>(root: P) -> Self
Build paths anchored at an explicit root. Useful for tests with tempdirs.
Sourcepub fn ensure_dirs(&self) -> Result<()>
pub fn ensure_dirs(&self) -> Result<()>
Create the cache directory tree with 0700 perms.
Sourcepub fn daemon_config_path(&self) -> PathBuf
pub fn daemon_config_path(&self) -> PathBuf
Path to zshrs-daemon.toml — the daemon’s HTTP/auth/log/cache
config. Renamed from the bare daemon.toml (briefly used during
the initial seeding work) so every config file in the dir
shares the zshrs[-binary].toml naming convention. Migration
from the old name is in ensure_default_configs.
Sourcepub fn shell_config_path(&self) -> PathBuf
pub fn shell_config_path(&self) -> PathBuf
Path to zshrs.toml — shell-side daemon-presence + skip-configs
- log-level knobs (consumed by the
zshrsbinary).
Sourcepub fn recorder_config_path(&self) -> PathBuf
pub fn recorder_config_path(&self) -> PathBuf
Path to zshrs-recorder.toml — recorder-side log level + future
runtime knobs (e.g. default –shell-id, default –quiet, etc.).
Sourcepub fn ensure_default_configs(&self) -> Result<()>
pub fn ensure_default_configs(&self) -> Result<()>
Seed every default config file under ~/.zshrs/ if absent:
zshrs.toml— shell knobszshrs-daemon.toml— daemon knobs (auto-migrates from the legacydaemon.toml)zshrs-recorder.toml— recorder knobs
Idempotent — never overwrites a user-edited file. Files are
chmod’d 0600 because the same root holds secrets-bearing tokens
once the user opts in. Called by every binary
(zshrs / zshrs-daemon / zshrs-recorder / zd) at startup
so whichever runs first gets the user a fully-populated
~/.zshrs/ tree without manual intervention.
Sourcepub fn is_first_run(&self) -> bool
pub fn is_first_run(&self) -> bool
Has the daemon ever completed an init pass on this machine for this user? First-run = no daemon.pid AND no index.rkyv AND no shards in images/.
Trait Implementations§
Source§impl Clone for CachePaths
impl Clone for CachePaths
Source§fn clone(&self) -> CachePaths
fn clone(&self) -> CachePaths
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more