pub struct SignatureVerificationCache { /* private fields */ }
Expand description

A signature verification cache.

Implementations§

source§

impl SignatureVerificationCache

source

pub fn cache_hits() -> usize

Returns the number of cache hits.

source

pub fn cache_misses() -> usize

Returns the number of cache misses.

source

pub fn insertions() -> usize

Returns the number of cache insertions.

This returns the number of times an entry was added to the cache since the program started or the last time SignatureVerificationCache::clear_insertions was called.

This does not include entries added via SignatureVerificationCache::restore.

source

pub fn clear_insertions()

Resets the insertions counter.

source

pub fn restore<'a, F>( entries: impl Iterator<Item = Vec<u8>> + Send + Sync + 'static, finished: F, )
where F: FnOnce() + Send + Sync + 'static,

Restores the signature verification cache.

This merges the entries into the existing signature cache.

The values are the values as returned by Entry::value.

The iterator is Send, Sync and 'static, because this function may spawn a thread to avoid blocking the main thread.

When the restore is complete, finished is called.

source

pub fn dump<'a>() -> impl IntoIterator<Item = Entry>

Dumps the contents of the cache.

This clones the cache to avoid holding locks too long.

The values returned by Entry::value may be written to a file, and restored using SignatureVerificationCache::restore.

Before saving them, you may want to check if there were any insertions using SignatureVerificationCache::insertions.

Also, you may want to prune the entries to avoid having the cache grow without bound.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T