Struct mithril_client::ClientBuilder
source · pub struct ClientBuilder { /* private fields */ }Expand description
Builder than can be used to create a Client easily or with custom dependencies.
Implementations§
source§impl ClientBuilder
impl ClientBuilder
sourcepub fn aggregator(
endpoint: &str,
genesis_verification_key: &str
) -> ClientBuilder
pub fn aggregator( endpoint: &str, genesis_verification_key: &str ) -> ClientBuilder
Constructs a new ClientBuilder that fetches data from the aggregator at the given
endpoint and with the given genesis verification key.
sourcepub fn new(genesis_verification_key: &str) -> ClientBuilder
pub fn new(genesis_verification_key: &str) -> ClientBuilder
Constructs a new ClientBuilder without any dependency set.
Use ClientBuilder::aggregator if you don’t need to set a custom AggregatorClient to request data from the aggregator.
sourcepub fn build(self) -> MithrilResult<Client>
pub fn build(self) -> MithrilResult<Client>
Returns a Client that uses the dependencies provided to this ClientBuilder.
The builder will try to create the missing dependencies using default implementations if possible.
sourcepub fn with_aggregator_client(
self,
aggregator_client: Arc<dyn AggregatorClient>
) -> ClientBuilder
pub fn with_aggregator_client( self, aggregator_client: Arc<dyn AggregatorClient> ) -> ClientBuilder
Set the AggregatorClient that will be used to request data to the aggregator.
sourcepub fn with_certificate_verifier(
self,
certificate_verifier: Arc<dyn CertificateVerifier>
) -> ClientBuilder
pub fn with_certificate_verifier( self, certificate_verifier: Arc<dyn CertificateVerifier> ) -> ClientBuilder
Set the CertificateVerifier that will be used to validate certificates.
sourcepub fn with_snapshot_downloader(
self,
snapshot_downloader: Arc<dyn SnapshotDownloader>
) -> ClientBuilder
Available on crate feature fs only.
pub fn with_snapshot_downloader( self, snapshot_downloader: Arc<dyn SnapshotDownloader> ) -> ClientBuilder
fs only.Set the SnapshotDownloader that will be used to download snapshots.
sourcepub fn with_logger(self, logger: Logger) -> Self
pub fn with_logger(self, logger: Logger) -> Self
Set the Logger to use.
sourcepub fn add_feedback_receiver(self, receiver: Arc<dyn FeedbackReceiver>) -> Self
pub fn add_feedback_receiver(self, receiver: Arc<dyn FeedbackReceiver>) -> Self
Add a feedback receiver to receive events for tasks that can have a long duration (ie: snapshot download or a long certificate chain validation).