Struct vapcore_light::cache::Cache [−][src]
The light client data cache.
Note that almost all getter methods take &mut self
due to the necessity to update
the underlying LRU-caches on read.
LRU-cache
Implementations
impl Cache
[src]
pub fn new(sizes: CacheSizes, corpus_expiration: Duration) -> Self
[src]
Create a new data cache with the given sizes and gas price corpus expiration time.
pub fn block_header(&mut self, hash: &H256) -> Option<Header>
[src]
Query header by hash.
pub fn block_hash(&mut self, num: BlockNumber) -> Option<H256>
[src]
Query hash by number.
pub fn block_body(&mut self, hash: &H256) -> Option<Body>
[src]
Query block body by block hash.
pub fn block_receipts(&mut self, hash: &H256) -> Option<Vec<Receipt>>
[src]
Query block receipts by block hash.
pub fn chain_score(&mut self, hash: &H256) -> Option<U256>
[src]
Query chain score by block hash.
pub fn insert_block_header(&mut self, hash: H256, hdr: Header)
[src]
Cache the given header.
pub fn insert_block_hash(&mut self, num: BlockNumber, hash: H256)
[src]
Cache the given canonical block hash.
pub fn insert_block_body(&mut self, hash: H256, body: Body)
[src]
Cache the given block body.
pub fn insert_block_receipts(&mut self, hash: H256, receipts: Vec<Receipt>)
[src]
Cache the given block receipts.
pub fn insert_chain_score(&mut self, hash: H256, score: U256)
[src]
Cache the given chain scoring.
pub fn gas_price_corpus(&self) -> Option<Corpus<U256>>
[src]
Get gas price corpus, if recent enough.
pub fn set_gas_price_corpus(&mut self, corpus: Corpus<U256>)
[src]
Set the cached gas price corpus.
pub fn mem_used(&self) -> usize
[src]
Get the memory used.
Trait Implementations
impl MallocSizeOf for Cache
[src]
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize
[src]
Auto Trait Implementations
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> MallocSizeOfExt for T where
T: MallocSizeOf,
[src]
T: MallocSizeOf,
pub fn malloc_size_of(&self) -> usize
[src]
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,