Skip to main content

DomainCache

Struct DomainCache 

Source
pub struct DomainCache {
    pub root: PathBuf,
    pub domain: String,
}
Expand description

Domain-specific cache operations

Fields§

§root: PathBuf§domain: String

Implementations§

Source§

impl DomainCache

Source

pub fn mycelium_dir(&self) -> PathBuf

Get the mycelium metadata directory

Source

pub fn spore_dir(&self) -> PathBuf

Get the spore cache directory

Source

pub fn spore_path(&self, hash: &str) -> PathBuf

Get the cache path for a specific spore

Source

pub fn repos_dir(&self) -> PathBuf

Get the repos cache directory for this domain

Source

pub fn repo_path(&self, root_commit: &str) -> PathBuf

Get the cache path for a specific repository by root_commit

Source

pub fn cmn_path(&self) -> PathBuf

Get path to cached cmn.json

Source

pub fn domain_state_path(&self) -> PathBuf

Get path to the local cmn.json domain-state pin.

Source

pub fn load_cmn(&self) -> Option<CmnEntry>

Load cached cmn.json entry

Source

pub fn save_cmn(&self, entry: &CmnEntry) -> Result<(), HyphaError>

Save cmn.json entry to cache

Source

pub fn load_domain_state(&self) -> Option<DomainStatePin>

Load the local anti-rollback pin for this domain.

Source

pub fn validate_and_pin_cmn_state( &self, entry: &CmnEntry, ) -> Result<(), HyphaError>

Verify the fetched cmn.json against the local pin and advance the pin.

Source

pub fn mycelium_path(&self) -> PathBuf

Get path to mycelium.json (complete manifest with spores list)

Source

pub fn load_mycelium(&self) -> Option<Value>

Load cached full mycelium manifest

Source

pub fn save_mycelium(&self, mycelium: &Value) -> Result<(), HyphaError>

Save full mycelium manifest to cache

Source

pub fn status_path(&self) -> PathBuf

Get path to status.json

Source

pub fn load_status(&self) -> CacheStatus

Load cache status

Source

pub fn save_status(&self, status: &CacheStatus) -> Result<(), HyphaError>

Save cache status

Source

pub fn domain_taste_path(&self) -> PathBuf

Get path to domain-level taste.json

Source

pub fn load_domain_taste(&self) -> Option<TasteVerdictCache>

Load cached taste verdict for the domain itself

Source

pub fn save_domain_taste( &self, verdict: &TasteVerdictCache, ) -> Result<(), HyphaError>

Save taste verdict for the domain itself

Source

pub fn taste_path(&self, hash: &str) -> PathBuf

Get path to taste.json for a spore

Source

pub fn load_taste(&self, hash: &str) -> Option<TasteVerdictCache>

Load cached taste verdict for a spore

Source

pub fn save_taste( &self, hash: &str, verdict: &TasteVerdictCache, ) -> Result<(), HyphaError>

Save taste verdict for a spore

Source

pub fn key_trust_path(&self) -> PathBuf

Get path to key_trust.json for this domain

Source

pub fn load_key_trust(&self) -> Vec<KeyTrustEntry>

Load cached key trust entries

Source

pub fn save_key_trust(&self, key: &str) -> Result<(), HyphaError>

Save a key trust entry (domain confirmed this key).

Read-modify-write happens under the directory lock so concurrent confirmations can’t clobber each other’s entries.

Source

pub fn save_key_trust_with_retirement( &self, key: &str, retired_at_epoch_ms: Option<u64>, ) -> Result<(), HyphaError>

Save a key trust entry with the retirement cutoff advertised by cmn.json.

Source

pub fn is_key_trusted( &self, key: &str, ttl_ms: u64, clock_skew_tolerance_ms: u64, ) -> bool

Check if a key is trusted within the given TTL (milliseconds). Applies clock skew tolerance to prevent false negatives from clock drift.

Source

pub fn is_key_trusted_for_time( &self, key: &str, signed_at_epoch_ms: u64, ttl_ms: u64, clock_skew_tolerance_ms: u64, ) -> bool

Check if a key is trusted for content signed at the given timestamp.

Source

pub fn update_cmn_status(&self, success: bool, error: Option<&str>)

Update cmn.json fetch status (locked read-modify-write).

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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, 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<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