Skip to main content

CachePaths

Struct CachePaths 

Source
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: PathBuf

root field.

§images: PathBuf

images field.

§catalog_db: PathBuf

catalog_db field.

§history_db: PathBuf

history_db field.

§log: PathBuf

log field.

§log_dir: PathBuf

log_dir field.

§log_file_name: String

log_file_name field.

§socket: PathBuf

socket field.

§pid_file: PathBuf

pid_file field.

§index_rkyv: PathBuf

index_rkyv field.

§replay_dir: PathBuf

replay/ — 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: PathBuf

cache.db — daemon-as-service KV cache, namespaced. See docs/DAEMON_AS_SERVICE.md daemon.cache.* ops + daemon/cache.rs.

§artifacts_dir: PathBuf

artifacts/ — content-addressed artifact cache. Files live at artifacts/<sha256_prefix>/<sha256_hex>. See docs/DAEMON_AS_SERVICE.md daemon.artifact.* ops.

§snapshots_dir: PathBuf

snapshots/ — tag-based canonical-state snapshots. See docs/DAEMON_AS_SERVICE.md daemon.snapshot.* ops.

Implementations§

Source§

impl CachePaths

Source

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.

Source

pub fn with_root<P: Into<PathBuf>>(root: P) -> Self

Build paths anchored at an explicit root. Useful for tests with tempdirs.

Source

pub fn ensure_dirs(&self) -> Result<()>

Create the cache directory tree with 0700 perms.

Source

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.

Source

pub fn shell_config_path(&self) -> PathBuf

Path to zshrs.toml — shell-side daemon-presence + skip-configs

  • log-level knobs (consumed by the zshrs binary).
Source

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.).

Source

pub fn ensure_default_configs(&self) -> Result<()>

Seed every default config file under ~/.zshrs/ if absent:

  • zshrs.toml — shell knobs
  • zshrs-daemon.toml — daemon knobs (auto-migrates from the legacy daemon.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.

Source

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

Source§

fn clone(&self) -> CachePaths

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CachePaths

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more