pub struct LightClientBuilder<State, H: MerkleHash + Sha256 + Default> { /* private fields */ }
Expand description
Builder for a light client Instance
Implementations§
source§impl LightClientBuilder<NoTrustedState, Sha256>
impl LightClientBuilder<NoTrustedState, Sha256>
sourcepub fn prod(
peer_id: PeerId,
rpc_client: HttpClient,
light_store: Box<dyn LightStore>,
options: Options,
timeout: Option<Duration>
) -> Self
pub fn prod( peer_id: PeerId, rpc_client: HttpClient, light_store: Box<dyn LightStore>, options: Options, timeout: Option<Duration> ) -> Self
Initialize a builder for a production (non-mock) light client.
source§impl<H> LightClientBuilder<NoTrustedState, H>
impl<H> LightClientBuilder<NoTrustedState, H>
sourcepub fn custom(
peer_id: PeerId,
options: Options,
light_store: Box<dyn LightStore>,
io: Box<dyn Io>,
clock: Box<dyn Clock>,
verifier: Box<dyn Verifier>,
scheduler: Box<dyn Scheduler>,
predicates: Box<dyn VerificationPredicates<Sha256 = H>>
) -> Self
pub fn custom( peer_id: PeerId, options: Options, light_store: Box<dyn LightStore>, io: Box<dyn Io>, clock: Box<dyn Clock>, verifier: Box<dyn Verifier>, scheduler: Box<dyn Scheduler>, predicates: Box<dyn VerificationPredicates<Sha256 = H>> ) -> Self
Initialize a builder for a custom light client, by providing all dependencies upfront.
sourcepub fn trust_light_block(
self,
trusted_state: LightBlock
) -> Result<LightClientBuilder<HasTrustedState, H>, Error>
pub fn trust_light_block( self, trusted_state: LightBlock ) -> Result<LightClientBuilder<HasTrustedState, H>, Error>
Set the given light block as the initial trusted state.
sourcepub fn trust_from_store(
self
) -> Result<LightClientBuilder<HasTrustedState, H>, Error>
pub fn trust_from_store( self ) -> Result<LightClientBuilder<HasTrustedState, H>, Error>
Keep using the latest verified or trusted block in the light store. Such a block must exists otherwise this will fail.
sourcepub fn trust_primary_at(
self,
trusted_height: Height,
trusted_hash: Hash
) -> Result<LightClientBuilder<HasTrustedState, H>, Error>
pub fn trust_primary_at( self, trusted_height: Height, trusted_hash: Hash ) -> Result<LightClientBuilder<HasTrustedState, H>, Error>
Set the block from the primary peer at the given height as the trusted state.
source§impl<H> LightClientBuilder<HasTrustedState, H>
impl<H> LightClientBuilder<HasTrustedState, H>
Auto Trait Implementations§
impl<State, H> Freeze for LightClientBuilder<State, H>where
State: Freeze,
impl<State, H> !RefUnwindSafe for LightClientBuilder<State, H>
impl<State, H> Send for LightClientBuilder<State, H>where
State: Send,
impl<State, H> Sync for LightClientBuilder<State, H>where
State: Sync,
impl<State, H> Unpin for LightClientBuilder<State, H>where
State: Unpin,
impl<State, H> !UnwindSafe for LightClientBuilder<State, H>
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