Struct ethcore::verification::queue::VerificationQueue
source · [−]pub struct VerificationQueue<K: Kind> { /* private fields */ }
Expand description
A queue of items to be verified. Sits between network or other I/O and the BlockChain
.
Keeps them in the same order as inserted, minus invalid items.
Implementations
sourceimpl<K: Kind> VerificationQueue<K>
impl<K: Kind> VerificationQueue<K>
sourcepub fn new(
config: Config,
engine: Arc<dyn EthEngine>,
message_channel: IoChannel<ClientIoMessage>,
check_seal: bool
) -> Self
pub fn new(
config: Config,
engine: Arc<dyn EthEngine>,
message_channel: IoChannel<ClientIoMessage>,
check_seal: bool
) -> Self
Creates a new queue instance.
sourcepub fn import(&self, input: K::Input) -> Result<H256, (Option<K::Input>, Error)>
pub fn import(&self, input: K::Input) -> Result<H256, (Option<K::Input>, Error)>
Add a block to the queue.
sourcepub fn mark_as_bad(&self, hashes: &[H256])
pub fn mark_as_bad(&self, hashes: &[H256])
Mark given item and all its children as bad. pauses verification until complete.
sourcepub fn mark_as_good(&self, hashes: &[H256]) -> bool
pub fn mark_as_good(&self, hashes: &[H256]) -> bool
Mark given item as processed. Returns true if the queue becomes empty.
sourcepub fn drain(&self, max: usize) -> Vec<K::Verified>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn drain(&self, max: usize) -> Vec<K::Verified>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Removes up to max
verified items from the queue
sourcepub fn resignal_verification(&self)
pub fn resignal_verification(&self)
release taken signal and call async ClientIoMessage::BlockVerified call to client so that it can continue verification. difference between sync and async is whose thread pool is used.
sourcepub fn reset_verification_ready_signal(&self)
pub fn reset_verification_ready_signal(&self)
Reset verification ready signal so that it allows other threads to send IoMessage to Client
sourcepub fn is_processing_fork(
&self,
best_block_hash: &H256,
chain: &BlockChain
) -> bool
pub fn is_processing_fork(
&self,
best_block_hash: &H256,
chain: &BlockChain
) -> bool
Returns true if there are descendants of the current best block in the processing queue
sourcepub fn queue_info(&self) -> QueueInfo
pub fn queue_info(&self) -> QueueInfo
Get queue status.
sourcepub fn total_difficulty(&self) -> U256
pub fn total_difficulty(&self) -> U256
Get the total difficulty of all the blocks in the queue.
sourcepub fn num_verifiers(&self) -> usize
pub fn num_verifiers(&self) -> usize
Get the current number of working verifiers.
sourcepub fn collect_garbage(&self)
pub fn collect_garbage(&self)
Optimise memory footprint of the heap fields, and adjust the number of threads to better suit the workload.
Trait Implementations
Auto Trait Implementations
impl<K> !RefUnwindSafe for VerificationQueue<K>
impl<K> Send for VerificationQueue<K>
impl<K> Sync for VerificationQueue<K>
impl<K> Unpin for VerificationQueue<K>
impl<K> !UnwindSafe for VerificationQueue<K>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more