pub struct MockChainSync<Block: BlockT> { /* private fields */ }

Implementations§

source§

impl<Block: BlockT> MockChainSync<Block>

source

pub fn checkpoint(&mut self)

Validate that all current expectations for all methods have been satisfied, and discard them.

source

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>

source

pub fn expect_peer_info(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the peer_info method

source

pub fn expect_status(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the status method

source

pub fn expect_num_sync_requests(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the num_sync_requests method

source

pub fn expect_num_downloaded_blocks(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the num_downloaded_blocks method

source

pub fn expect_num_peers(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the num_peers method

source

pub fn expect_num_active_peers(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the num_active_peers method

source

pub fn expect_new_peer(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the new_peer method

source

pub fn expect_update_chain_info(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the update_chain_info method

source

pub fn expect_request_justification(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the request_justification method

source

pub fn expect_clear_justification_requests(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the clear_justification_requests method

source

pub fn expect_set_sync_fork_request(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the set_sync_fork_request method

source

pub fn expect_on_block_data(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the on_block_data method

source

pub fn expect_on_block_justification(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the on_block_justification method

source

pub fn expect_on_justification_import(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the on_justification_import method

source

pub fn expect_on_block_finalized(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the on_block_finalized method

source

pub fn expect_push_block_announce_validation( &mut self ) -> &mut Expectation<Block>

Create an Expectation for mocking the push_block_announce_validation method

source

pub fn expect_poll_block_announce_validation( &mut self ) -> &mut Expectation<Block>

Create an Expectation for mocking the poll_block_announce_validation method

source

pub fn expect_peer_disconnected(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the peer_disconnected method

source

pub fn expect_metrics(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the metrics method

source

pub fn expect_block_response_into_blocks(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the block_response_into_blocks method

source

pub fn expect_poll(&mut self) -> &mut Expectation<Block>

Create an Expectation for mocking the poll method

source

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>

source§

fn peer_info(&self, who: &PeerId) -> Option<PeerInfo<Block>>

Returns the state of the sync of the given peer. Read more
source§

fn status(&self) -> SyncStatus<Block>

Returns the current sync status.
source§

fn num_sync_requests(&self) -> usize

Number of active forks requests. This includes requests that are pending or could be issued right away.
source§

fn num_downloaded_blocks(&self) -> usize

Number of downloaded blocks.
source§

fn num_peers(&self) -> usize

Returns the current number of peers stored within this state machine.
source§

fn num_active_peers(&self) -> usize

Returns the number of peers we’re connected to and that are being queried.
source§

fn new_peer( &mut self, who: PeerId, best_hash: Block::Hash, best_number: NumberFor<Block> ) -> Result<Option<BlockRequest<Block>>, BadPeer>

Handle a new connected peer. Read more
source§

fn update_chain_info( &mut self, best_hash: &Block::Hash, best_number: NumberFor<Block> )

Signal that a new best block has been imported.
source§

fn request_justification( &mut self, hash: &Block::Hash, number: NumberFor<Block> )

Schedule a justification request for the given block.
source§

fn clear_justification_requests(&mut self)

Clear all pending justification requests.
source§

fn set_sync_fork_request( &mut self, peers: Vec<PeerId>, hash: &Block::Hash, number: NumberFor<Block> )

Request syncing for the given block from given set of peers.
source§

fn on_block_data( &mut self, who: &PeerId, request: Option<BlockRequest<Block>>, response: BlockResponse<Block> ) -> Result<OnBlockData<Block>, BadPeer>

Handle a response from the remote to a block request that we made. Read more
source§

fn on_block_justification( &mut self, who: PeerId, response: BlockResponse<Block> ) -> Result<OnBlockJustification<Block>, BadPeer>

Handle a response from the remote to a justification request that we made. Read more
source§

fn on_justification_import( &mut self, hash: Block::Hash, number: NumberFor<Block>, success: bool )

Call this when a justification has been processed by the import queue, with or without errors.
source§

fn on_block_finalized(&mut self, hash: &Block::Hash, number: NumberFor<Block>)

Notify about finalization of the given block.
source§

fn push_block_announce_validation( &mut self, who: PeerId, hash: Block::Hash, announce: BlockAnnounce<Block::Header>, is_best: bool )

Push a block announce validation. Read more
source§

fn poll_block_announce_validation<'a>( &mut self, cx: &mut Context<'a> ) -> Poll<PollBlockAnnounceValidation<Block::Header>>

Poll block announce validation. Read more
source§

fn peer_disconnected(&mut self, who: &PeerId)

Call when a peer has disconnected. Canceled obsolete block request may result in some blocks being ready for import, so this functions checks for such blocks and returns them.
source§

fn metrics(&self) -> Metrics

Return some key metrics.
source§

fn block_response_into_blocks( &self, request: &BlockRequest<Block>, response: OpaqueBlockResponse ) -> Result<Vec<BlockData<Block>>, String>

Access blocks from implementation-specific block response.
source§

fn poll<'a>( &mut self, cx: &mut Context<'a> ) -> Poll<PollBlockAnnounceValidation<Block::Header>>

Advance the state of ChainSync Read more
source§

fn send_block_request(&mut self, who: PeerId, request: BlockRequest<Block>)

Send block request to peer
source§

impl<Block: BlockT> Default for MockChainSync<Block>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send + 'static>

source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedConversion for T

source§

fn checked_from<T>(t: T) -> Option<Self>where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
source§

fn checked_into<T>(self) -> Option<T>where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

source§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

source§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatedConversion for T

source§

fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
source§

fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,

source§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
source§

impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,

source§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> JsonSchemaMaybe for T

source§

impl<T> MaybeRefUnwindSafe for Twhere T: RefUnwindSafe,