pub struct OutputCache { /* private fields */ }Expand description
A cache of outputs from the blockchain database.
Implementations§
Source§impl OutputCache
impl OutputCache
Sourcepub const fn new(
cached_outputs: IndexMap<u64, IndexMap<u64, OutputOnChain>>,
number_of_outputs: IndexMap<u64, u64>,
wanted_outputs: IndexMap<u64, IndexSet<u64>>,
) -> Self
pub const fn new( cached_outputs: IndexMap<u64, IndexMap<u64, OutputOnChain>>, number_of_outputs: IndexMap<u64, u64>, wanted_outputs: IndexMap<u64, IndexSet<u64>>, ) -> Self
Create a new OutputCache.
Sourcepub const fn cached_outputs(
&self,
) -> &IndexMap<u64, IndexMap<u64, OutputOnChain>>
pub const fn cached_outputs( &self, ) -> &IndexMap<u64, IndexMap<u64, OutputOnChain>>
Returns the set of currently cached outputs.
§Warning
Self::get_output should be preferred over this when possible, this will not contain all outputs
asked for necessarily.
Sourcepub fn number_outs_with_amount(&self, amount: u64) -> usize
pub fn number_outs_with_amount(&self, amount: u64) -> usize
Returns the number of outputs in the blockchain with the given amount.
§Warning
The cache will only track the amount of outputs with a given amount for the requested outputs.
So if you do not request an output with amount when generating the cache the amount of outputs
with value amount will not be tracked.
Sourcepub fn get_output(&self, amount: u64, index: u64) -> Option<&OutputOnChain>
pub fn get_output(&self, amount: u64, index: u64) -> Option<&OutputOnChain>
Request an output with a given amount and amount index from the cache.
Sourcepub fn add_block_to_cache(&mut self, block: &VerifiedBlockInformation)
pub fn add_block_to_cache(&mut self, block: &VerifiedBlockInformation)
Adds a block to the cache.
This function will add any outputs to the cache that were requested when building the cache but were not in the DB, if they are in the block.
You should not add blocks to the cache before the block has been verified.
Trait Implementations§
Source§impl Clone for OutputCache
impl Clone for OutputCache
Source§fn clone(&self) -> OutputCache
fn clone(&self) -> OutputCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OutputCache
impl Debug for OutputCache
impl Eq for OutputCache
Source§impl PartialEq for OutputCache
impl PartialEq for OutputCache
impl StructuralPartialEq for OutputCache
Auto Trait Implementations§
impl Freeze for OutputCache
impl RefUnwindSafe for OutputCache
impl Send for OutputCache
impl Sync for OutputCache
impl Unpin for OutputCache
impl UnsafeUnpin for OutputCache
impl UnwindSafe for OutputCache
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 216 bytes