Struct RuntimeCache
pub struct RuntimeCache {
pub chains: BTreeMap<String, BTreeMap<String, RuntimeEntry>>,
}Expand description
In-memory mirror of ~/.config/deadeye/runtimes.toml.
TOML shape:
[mainnet.normal]
address = "0x..."
class_hash = "0x..."
deployed_at_block = 1234567
deployed_tx = "0x..."
[sepolia.normal]
# ...Fields§
§chains: BTreeMap<String, BTreeMap<String, RuntimeEntry>>Outer map keyed by chain slug (mainnet, sepolia, devnet), inner
map keyed by family slug (normal, lognormal, …).
Implementations§
§impl RuntimeCache
impl RuntimeCache
pub fn default_path() -> Result<PathBuf, DeployerError>
pub fn default_path() -> Result<PathBuf, DeployerError>
Default cache path: ~/.config/deadeye/runtimes.toml. Honors
DEADEYE_RUNTIMES_PATH for tests + overrides.
pub fn load(path: &Path) -> Result<Self, DeployerError>
pub fn load(path: &Path) -> Result<Self, DeployerError>
Load the cache from path. Missing file returns an empty cache.
Malformed TOML returns a typed error.
pub fn save(&self, path: &Path) -> Result<(), DeployerError>
pub fn save(&self, path: &Path) -> Result<(), DeployerError>
Persist the cache to path. Creates the parent directory if needed.
Uses a temp-file + atomic rename pattern so a crash mid-write (or
two concurrent CLIs racing) can never produce a half-written /
corrupted TOML file. The temp file lives next to path so the
rename stays on the same filesystem (POSIX-atomic).
pub fn get(&self, chain: ChainKey, family: Family) -> Option<&RuntimeEntry>
pub fn get(&self, chain: ChainKey, family: Family) -> Option<&RuntimeEntry>
Look up a cached entry.
pub fn upsert(
&mut self,
chain: ChainKey,
family: Family,
entry: RuntimeEntry,
) -> Option<RuntimeEntry>
pub fn upsert( &mut self, chain: ChainKey, family: Family, entry: RuntimeEntry, ) -> Option<RuntimeEntry>
Insert / replace an entry. Returns the previous value, if any.
Trait Implementations§
§impl Clone for RuntimeCache
impl Clone for RuntimeCache
§fn clone(&self) -> RuntimeCache
fn clone(&self) -> RuntimeCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for RuntimeCache
impl Debug for RuntimeCache
§impl Default for RuntimeCache
impl Default for RuntimeCache
§fn default() -> RuntimeCache
fn default() -> RuntimeCache
§impl<'de> Deserialize<'de> for RuntimeCache
impl<'de> Deserialize<'de> for RuntimeCache
§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
§impl PartialEq for RuntimeCache
impl PartialEq for RuntimeCache
§impl Serialize for RuntimeCache
impl Serialize for RuntimeCache
impl Eq for RuntimeCache
impl StructuralPartialEq for RuntimeCache
Auto Trait Implementations§
impl Freeze for RuntimeCache
impl RefUnwindSafe for RuntimeCache
impl Send for RuntimeCache
impl Sync for RuntimeCache
impl Unpin for RuntimeCache
impl UnsafeUnpin for RuntimeCache
impl UnwindSafe for RuntimeCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.