[][src]Struct zebrad::components::sync::ChainSync

pub struct ChainSync<ZN, ZS, ZV> where
    ZN: Service<Request, Response = Response, Error = Box<dyn Error + Send + Sync + 'static>> + Send + Clone + 'static,
    ZN::Future: Send,
    ZS: Service<Request, Response = Response, Error = Box<dyn Error + Send + Sync + 'static>> + Send + Clone + 'static,
    ZS::Future: Send,
    ZV: Service<Arc<Block>, Response = Hash, Error = Box<dyn Error + Send + Sync + 'static>> + Send + Clone + 'static,
    ZV::Future: Send
{ tip_network: Timeout<ZN>, state: ZS, prospective_tips: HashSet<CheckedTip>, genesis_hash: Hash, lookahead_limit: usize, downloads: Pin<Box<Downloads<Hedge<ConcurrencyLimit<Retry<RetryLimit, Timeout<ZN>>>, AlwaysHedge>, ZV>>>, }

Fields

tip_network: Timeout<ZN>

Used to perform ObtainTips and ExtendTips requests, with no retry logic (failover is handled using fanout).

state: ZSprospective_tips: HashSet<CheckedTip>genesis_hash: Hashlookahead_limit: usizedownloads: Pin<Box<Downloads<Hedge<ConcurrencyLimit<Retry<RetryLimit, Timeout<ZN>>>, AlwaysHedge>, ZV>>>

Implementations

impl<ZN, ZS, ZV> ChainSync<ZN, ZS, ZV> where
    ZN: Service<Request, Response = Response, Error = Box<dyn Error + Send + Sync + 'static>> + Send + Clone + 'static,
    ZN::Future: Send,
    ZS: Service<Request, Response = Response, Error = Box<dyn Error + Send + Sync + 'static>> + Send + Clone + 'static,
    ZS::Future: Send,
    ZV: Service<Arc<Block>, Response = Hash, Error = Box<dyn Error + Send + Sync + 'static>> + Send + Clone + 'static,
    ZV::Future: Send
[src]

Polls the network to determine whether further blocks are available and downloads them.

This component is used for initial block sync, but the Inbound service is responsible for participating in the gossip protocols used for block diffusion.

pub fn new(config: &ZebradConfig, peers: ZN, state: ZS, verifier: ZV) -> Self[src]

Returns a new syncer instance, using:

  • chain: the zebra-chain Network to download (Mainnet or Testnet)
  • peers: the zebra-network peers to contact for downloads
  • state: the zebra-state that stores the chain
  • verifier: the zebra-consensus verifier that checks the chain

pub async fn sync(self) -> Result<(), Report>[src]

pub(in components::sync) async fn obtain_tips<'_>(
    &'_ mut self
) -> Result<(), Report>
[src]

Given a block_locator list fan out request for subsequent hashes to multiple peers

pub(in components::sync) async fn extend_tips<'_>(
    &'_ mut self
) -> Result<(), Report>
[src]

pub(in components::sync) async fn request_genesis<'_>(
    &'_ mut self
) -> Result<(), Report>
[src]

Download and verify the genesis block, if it isn't currently known to our node.

pub(in components::sync) async fn request_blocks<'_>(
    &'_ mut self,
    hashes: HashSet<Hash>
) -> Result<(), Report>
[src]

Queue download and verify tasks for each block that isn't currently known to our node

pub(in components::sync) async fn state_contains<'_>(
    &'_ mut self,
    hash: Hash
) -> Result<bool, Report>
[src]

Returns true if the hash is present in the state, and false if the hash is not present in the state.

TODO: handle multiple tips in the state.

pub(in components::sync) fn update_metrics(
    &self
)
[src]

Auto Trait Implementations

impl<ZN, ZS, ZV> !RefUnwindSafe for ChainSync<ZN, ZS, ZV>

impl<ZN, ZS, ZV> Send for ChainSync<ZN, ZS, ZV>

impl<ZN, ZS, ZV> !Sync for ChainSync<ZN, ZS, ZV>

impl<ZN, ZS, ZV> Unpin for ChainSync<ZN, ZS, ZV> where
    ZN: Unpin,
    ZS: Unpin

impl<ZN, ZS, ZV> !UnwindSafe for ChainSync<ZN, ZS, ZV>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsAny for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Erased for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<D> OwoColorize for D

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

impl<T> WithSubscriber for T[src]