Struct sc_network_sync::mock::MockChainSync
source · pub struct MockChainSync<Block: BlockT> { /* private fields */ }
Implementations§
source§impl<Block: BlockT> MockChainSync<Block>
impl<Block: BlockT> MockChainSync<Block>
sourcepub fn checkpoint(&mut self)
pub fn checkpoint(&mut self)
Validate that all current expectations for all methods have been satisfied, and discard them.
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new mock object with no expectations.
This method will not be generated if the real struct
already has a new
method. However, it will be
generated if the struct implements a trait with a new
method. The trait’s new
method can still be called
like <MockX as TraitY>::new
source§impl<Block: BlockT> MockChainSync<Block>
impl<Block: BlockT> MockChainSync<Block>
sourcepub fn expect_peer_info(&mut self) -> &mut Expectation<Block>
pub fn expect_peer_info(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the peer_info
method
sourcepub fn expect_status(&mut self) -> &mut Expectation<Block>
pub fn expect_status(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the status
method
sourcepub fn expect_num_sync_requests(&mut self) -> &mut Expectation<Block>
pub fn expect_num_sync_requests(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the num_sync_requests
method
sourcepub fn expect_num_downloaded_blocks(&mut self) -> &mut Expectation<Block>
pub fn expect_num_downloaded_blocks(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the num_downloaded_blocks
method
sourcepub fn expect_num_peers(&mut self) -> &mut Expectation<Block>
pub fn expect_num_peers(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the num_peers
method
sourcepub fn expect_num_active_peers(&mut self) -> &mut Expectation<Block>
pub fn expect_num_active_peers(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the num_active_peers
method
sourcepub fn expect_new_peer(&mut self) -> &mut Expectation<Block>
pub fn expect_new_peer(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the new_peer
method
sourcepub fn expect_update_chain_info(&mut self) -> &mut Expectation<Block>
pub fn expect_update_chain_info(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the update_chain_info
method
sourcepub fn expect_request_justification(&mut self) -> &mut Expectation<Block>
pub fn expect_request_justification(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the request_justification
method
sourcepub fn expect_clear_justification_requests(&mut self) -> &mut Expectation<Block>
pub fn expect_clear_justification_requests(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the clear_justification_requests
method
sourcepub fn expect_set_sync_fork_request(&mut self) -> &mut Expectation<Block>
pub fn expect_set_sync_fork_request(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the set_sync_fork_request
method
sourcepub fn expect_on_block_data(&mut self) -> &mut Expectation<Block>
pub fn expect_on_block_data(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the on_block_data
method
sourcepub fn expect_on_block_justification(&mut self) -> &mut Expectation<Block>
pub fn expect_on_block_justification(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the on_block_justification
method
sourcepub fn expect_on_justification_import(&mut self) -> &mut Expectation<Block>
pub fn expect_on_justification_import(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the on_justification_import
method
sourcepub fn expect_on_block_finalized(&mut self) -> &mut Expectation<Block>
pub fn expect_on_block_finalized(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the on_block_finalized
method
sourcepub fn expect_on_validated_block_announce(&mut self) -> &mut Expectation<Block>
pub fn expect_on_validated_block_announce(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the on_validated_block_announce
method
sourcepub fn expect_peer_disconnected(&mut self) -> &mut Expectation<Block>
pub fn expect_peer_disconnected(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the peer_disconnected
method
sourcepub fn expect_metrics(&mut self) -> &mut Expectation<Block>
pub fn expect_metrics(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the metrics
method
sourcepub fn expect_poll(&mut self) -> &mut Expectation<Block>
pub fn expect_poll(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the poll
method
sourcepub fn expect_send_block_request(&mut self) -> &mut Expectation<Block>
pub fn expect_send_block_request(&mut self) -> &mut Expectation<Block>
Create an Expectation
for mocking the send_block_request
method
Trait Implementations§
source§impl<Block: BlockT> ChainSync<Block> for MockChainSync<Block>
impl<Block: BlockT> ChainSync<Block> for MockChainSync<Block>
source§fn peer_info(&self, who: &PeerId) -> Option<PeerInfo<Block>>
fn peer_info(&self, who: &PeerId) -> Option<PeerInfo<Block>>
source§fn status(&self) -> SyncStatus<Block>
fn status(&self) -> SyncStatus<Block>
source§fn num_sync_requests(&self) -> usize
fn num_sync_requests(&self) -> usize
source§fn num_downloaded_blocks(&self) -> usize
fn num_downloaded_blocks(&self) -> usize
source§fn num_peers(&self) -> usize
fn num_peers(&self) -> usize
source§fn num_active_peers(&self) -> usize
fn num_active_peers(&self) -> usize
source§fn new_peer(
&mut self,
who: PeerId,
best_hash: Block::Hash,
best_number: NumberFor<Block>
) -> Result<Option<BlockRequest<Block>>, BadPeer>
fn new_peer( &mut self, who: PeerId, best_hash: Block::Hash, best_number: NumberFor<Block> ) -> Result<Option<BlockRequest<Block>>, BadPeer>
source§fn update_chain_info(
&mut self,
best_hash: &Block::Hash,
best_number: NumberFor<Block>
)
fn update_chain_info( &mut self, best_hash: &Block::Hash, best_number: NumberFor<Block> )
source§fn request_justification(
&mut self,
hash: &Block::Hash,
number: NumberFor<Block>
)
fn request_justification( &mut self, hash: &Block::Hash, number: NumberFor<Block> )
source§fn clear_justification_requests(&mut self)
fn clear_justification_requests(&mut self)
source§fn set_sync_fork_request(
&mut self,
peers: Vec<PeerId>,
hash: &Block::Hash,
number: NumberFor<Block>
)
fn set_sync_fork_request( &mut self, peers: Vec<PeerId>, hash: &Block::Hash, number: NumberFor<Block> )
source§fn on_block_data(
&mut self,
who: &PeerId,
request: Option<BlockRequest<Block>>,
response: BlockResponse<Block>
) -> Result<OnBlockData<Block>, BadPeer>
fn on_block_data( &mut self, who: &PeerId, request: Option<BlockRequest<Block>>, response: BlockResponse<Block> ) -> Result<OnBlockData<Block>, BadPeer>
source§fn on_block_justification(
&mut self,
who: PeerId,
response: BlockResponse<Block>
) -> Result<OnBlockJustification<Block>, BadPeer>
fn on_block_justification( &mut self, who: PeerId, response: BlockResponse<Block> ) -> Result<OnBlockJustification<Block>, BadPeer>
source§fn on_justification_import(
&mut self,
hash: Block::Hash,
number: NumberFor<Block>,
success: bool
)
fn on_justification_import( &mut self, hash: Block::Hash, number: NumberFor<Block>, success: bool )
source§fn on_block_finalized(&mut self, hash: &Block::Hash, number: NumberFor<Block>)
fn on_block_finalized(&mut self, hash: &Block::Hash, number: NumberFor<Block>)
source§fn on_validated_block_announce(
&mut self,
is_best: bool,
who: PeerId,
announce: &BlockAnnounce<Block::Header>
)
fn on_validated_block_announce( &mut self, is_best: bool, who: PeerId, announce: &BlockAnnounce<Block::Header> )
source§fn peer_disconnected(&mut self, who: &PeerId)
fn peer_disconnected(&mut self, who: &PeerId)
source§fn send_block_request(&mut self, who: PeerId, request: BlockRequest<Block>)
fn send_block_request(&mut self, who: PeerId, request: BlockRequest<Block>)
Auto Trait Implementations§
impl<Block> RefUnwindSafe for MockChainSync<Block>where Block: RefUnwindSafe,
impl<Block> Send for MockChainSync<Block>
impl<Block> Sync for MockChainSync<Block>
impl<Block> Unpin for MockChainSync<Block>where Block: Unpin,
impl<Block> UnwindSafe for MockChainSync<Block>where Block: UnwindSafe,
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
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
T
. Read moresource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.