Struct ckb_chain::chain::ChainController
source · pub struct ChainController { /* private fields */ }Expand description
Controller to the chain service.
The controller is internally reference-counted and can be freely cloned.
A controller can invoke ChainService methods.
Implementations§
source§impl ChainController
impl ChainController
pub fn new( process_block_sender: Sender<Request<(Arc<BlockView>, Switch), Result<bool, Error>>>, truncate_sender: Sender<Request<Byte32, Result<(), Error>>>, stop: StopHandler<()> ) -> Self
sourcepub fn process_block(&self, block: Arc<BlockView>) -> Result<bool, Error>
pub fn process_block(&self, block: Arc<BlockView>) -> Result<bool, Error>
Inserts the block into database.
Expects the block’s header to be valid and already verified.
If the block already exists, does nothing and false is returned.
BlockVerifier NonContextualBlockTxsVerifier ContextualBlockVerifier will performed
sourcepub fn internal_process_block(
&self,
block: Arc<BlockView>,
switch: Switch
) -> Result<bool, Error>
pub fn internal_process_block( &self, block: Arc<BlockView>, switch: Switch ) -> Result<bool, Error>
Internal method insert block for test
switch bit flags for particular verify, make easier to generating test data
sourcepub fn truncate(&self, target_tip_hash: Byte32) -> Result<(), Error>
pub fn truncate(&self, target_tip_hash: Byte32) -> Result<(), Error>
Truncate chain to specified target
Should use for testing only
pub fn try_stop(&mut self)
sourcepub fn non_owning_clone(&self) -> Self
pub fn non_owning_clone(&self) -> Self
Since a non-owning reference does not count towards ownership, it will not prevent the value stored in the allocation from being dropped
Trait Implementations§
source§impl Clone for ChainController
impl Clone for ChainController
source§fn clone(&self) -> ChainController
fn clone(&self) -> ChainController
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ChainController
impl Send for ChainController
impl Sync for ChainController
impl Unpin for ChainController
impl !UnwindSafe for ChainController
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
Mutably borrows from an owned value. Read more