pub trait TryCachingDb {
type Error: Error;
// Required methods
fn cache(&self) -> &Cache;
fn try_cache_mut(&mut self) -> Result<&mut Cache, Self::Error>;
fn try_into_cache(self) -> Result<Cache, Self::Error>;
// Provided methods
fn try_extend_ref(&mut self, cache: &Cache) -> Result<(), Self::Error>
where Self: Sized { ... }
fn try_extend(&mut self, cache: Cache) -> Result<(), Self::Error>
where Self: Sized { ... }
}Expand description
Trait for Databases that have a Cache and can fail to mutably access
it. E.g. Arc<CacheDB<Db>>
Required Associated Types§
Required Methods§
Sourcefn try_cache_mut(&mut self) -> Result<&mut Cache, Self::Error>
fn try_cache_mut(&mut self) -> Result<&mut Cache, Self::Error>
Attempt to get the cache mutably.
Sourcefn try_into_cache(self) -> Result<Cache, Self::Error>
fn try_into_cache(self) -> Result<Cache, Self::Error>
Attempt to deconstruct into the cache
Provided Methods§
Sourcefn try_extend_ref(&mut self, cache: &Cache) -> Result<(), Self::Error>where
Self: Sized,
fn try_extend_ref(&mut self, cache: &Cache) -> Result<(), Self::Error>where
Self: Sized,
Attempt to fold a cache into the database.
The behavior is as follows:
- Accounts are overridden with outer accounts
- Contracts are overridden with outer contracts
- Logs are appended
- Block hashes are overridden with outer block hashes
Sourcefn try_extend(&mut self, cache: Cache) -> Result<(), Self::Error>where
Self: Sized,
fn try_extend(&mut self, cache: Cache) -> Result<(), Self::Error>where
Self: Sized,
Attempt to extend the cache with the given cache by moving data.
The behavior is as follows:
- Accounts are overridden with outer accounts
- Contracts are overridden with outer contracts
- Logs are appended
- Block hashes are overridden with outer block hashes