pub struct DomainCache {
pub root: PathBuf,
pub domain: String,
}Expand description
Domain-specific cache operations
Fields§
§root: PathBuf§domain: StringImplementations§
Source§impl DomainCache
impl DomainCache
Sourcepub fn mycelium_dir(&self) -> PathBuf
pub fn mycelium_dir(&self) -> PathBuf
Get the mycelium metadata directory
Sourcepub fn spore_path(&self, hash: &str) -> PathBuf
pub fn spore_path(&self, hash: &str) -> PathBuf
Get the cache path for a specific spore
Sourcepub fn repo_path(&self, root_commit: &str) -> PathBuf
pub fn repo_path(&self, root_commit: &str) -> PathBuf
Get the cache path for a specific repository by root_commit
Sourcepub fn domain_state_path(&self) -> PathBuf
pub fn domain_state_path(&self) -> PathBuf
Get path to the local cmn.json domain-state pin.
Sourcepub fn save_cmn(&self, entry: &CmnEntry) -> Result<(), HyphaError>
pub fn save_cmn(&self, entry: &CmnEntry) -> Result<(), HyphaError>
Save cmn.json entry to cache
Sourcepub fn load_domain_state(&self) -> Option<DomainStatePin>
pub fn load_domain_state(&self) -> Option<DomainStatePin>
Load the local anti-rollback pin for this domain.
Sourcepub fn validate_and_pin_cmn_state(
&self,
entry: &CmnEntry,
) -> Result<(), HyphaError>
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.
Sourcepub fn mycelium_path(&self) -> PathBuf
pub fn mycelium_path(&self) -> PathBuf
Get path to mycelium.json (complete manifest with spores list)
Sourcepub fn load_mycelium(&self) -> Option<Value>
pub fn load_mycelium(&self) -> Option<Value>
Load cached full mycelium manifest
Sourcepub fn save_mycelium(&self, mycelium: &Value) -> Result<(), HyphaError>
pub fn save_mycelium(&self, mycelium: &Value) -> Result<(), HyphaError>
Save full mycelium manifest to cache
Sourcepub fn status_path(&self) -> PathBuf
pub fn status_path(&self) -> PathBuf
Get path to status.json
Sourcepub fn load_status(&self) -> CacheStatus
pub fn load_status(&self) -> CacheStatus
Load cache status
Sourcepub fn save_status(&self, status: &CacheStatus) -> Result<(), HyphaError>
pub fn save_status(&self, status: &CacheStatus) -> Result<(), HyphaError>
Save cache status
Sourcepub fn domain_taste_path(&self) -> PathBuf
pub fn domain_taste_path(&self) -> PathBuf
Get path to domain-level taste.json
Sourcepub fn load_domain_taste(&self) -> Option<TasteVerdictCache>
pub fn load_domain_taste(&self) -> Option<TasteVerdictCache>
Load cached taste verdict for the domain itself
Sourcepub fn save_domain_taste(
&self,
verdict: &TasteVerdictCache,
) -> Result<(), HyphaError>
pub fn save_domain_taste( &self, verdict: &TasteVerdictCache, ) -> Result<(), HyphaError>
Save taste verdict for the domain itself
Sourcepub fn taste_path(&self, hash: &str) -> PathBuf
pub fn taste_path(&self, hash: &str) -> PathBuf
Get path to taste.json for a spore
Sourcepub fn load_taste(&self, hash: &str) -> Option<TasteVerdictCache>
pub fn load_taste(&self, hash: &str) -> Option<TasteVerdictCache>
Load cached taste verdict for a spore
Sourcepub fn save_taste(
&self,
hash: &str,
verdict: &TasteVerdictCache,
) -> Result<(), HyphaError>
pub fn save_taste( &self, hash: &str, verdict: &TasteVerdictCache, ) -> Result<(), HyphaError>
Save taste verdict for a spore
Sourcepub fn key_trust_path(&self) -> PathBuf
pub fn key_trust_path(&self) -> PathBuf
Get path to key_trust.json for this domain
Sourcepub fn load_key_trust(&self) -> Vec<KeyTrustEntry>
pub fn load_key_trust(&self) -> Vec<KeyTrustEntry>
Load cached key trust entries
Sourcepub fn save_key_trust(&self, key: &str) -> Result<(), HyphaError>
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.
Sourcepub fn save_key_trust_with_retirement(
&self,
key: &str,
retired_at_epoch_ms: Option<u64>,
) -> Result<(), HyphaError>
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.
Sourcepub fn is_key_trusted(
&self,
key: &str,
ttl_ms: u64,
clock_skew_tolerance_ms: u64,
) -> bool
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.
Sourcepub fn is_key_trusted_for_time(
&self,
key: &str,
signed_at_epoch_ms: u64,
ttl_ms: u64,
clock_skew_tolerance_ms: u64,
) -> bool
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.
Sourcepub fn update_cmn_status(&self, success: bool, error: Option<&str>)
pub fn update_cmn_status(&self, success: bool, error: Option<&str>)
Update cmn.json fetch status (locked read-modify-write).