pub struct ClientBuilder { /* private fields */ }Expand description
Builder that 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
👎Deprecated since 0.12.36: Use new method instead and set the genesis verification key with set_genesis_verification_key
pub fn aggregator( endpoint: &str, genesis_verification_key: &str, ) -> ClientBuilder
new method instead and set the genesis verification key with set_genesis_verification_keyConstructs a new ClientBuilder that fetches data from the aggregator at the given
endpoint and with the given genesis verification key.
Sourcepub fn automatic(network: &str, genesis_verification_key: &str) -> ClientBuilder
Available on non-target_family=wasm only.
pub fn automatic(network: &str, genesis_verification_key: &str) -> ClientBuilder
target_family=wasm only.Constructs a new ClientBuilder that automatically discovers the aggregator for the given
Mithril network and with the given genesis verification key.
Sourcepub fn new(aggregator_discovery: AggregatorDiscoveryType) -> ClientBuilder
pub fn new(aggregator_discovery: AggregatorDiscoveryType) -> ClientBuilder
Constructs a new ClientBuilder without any dependency set.
Sourcepub fn set_genesis_verification_key(
self,
genesis_verification_key: GenesisVerificationKey,
) -> ClientBuilder
pub fn set_genesis_verification_key( self, genesis_verification_key: GenesisVerificationKey, ) -> ClientBuilder
Sets the genesis verification key to use when verifying certificates.
Sourcepub fn with_capabilities(
self,
capabilities: RequiredAggregatorCapabilities,
) -> ClientBuilder
Available on non-target_family=wasm only.
pub fn with_capabilities( self, capabilities: RequiredAggregatorCapabilities, ) -> ClientBuilder
target_family=wasm only.Sets the aggregator capabilities expected to be matched by the aggregator with which the client will interact.
Sourcepub fn with_aggregator_discoverer(
self,
discoverer: Arc<dyn AggregatorDiscoverer>,
) -> ClientBuilder
Available on non-target_family=wasm only.
pub fn with_aggregator_discoverer( self, discoverer: Arc<dyn AggregatorDiscoverer>, ) -> ClientBuilder
target_family=wasm only.Sets the aggregator discoverer to use to find the aggregator endpoint when in automatic discovery.
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 discover_aggregator(
&self,
network: &MithrilNetwork,
) -> MithrilResult<impl Iterator<Item = AggregatorEndpoint>>
Available on non-target_family=wasm only.
pub fn discover_aggregator( &self, network: &MithrilNetwork, ) -> MithrilResult<impl Iterator<Item = AggregatorEndpoint>>
target_family=wasm only.Discover available aggregator endpoints for the given Mithril network and required capabilities.
Sourcepub fn with_era_fetcher(self, era_fetcher: Arc<dyn EraFetcher>) -> ClientBuilder
pub fn with_era_fetcher(self, era_fetcher: Arc<dyn EraFetcher>) -> ClientBuilder
Sets the EraFetcher that will be used by the client to retrieve the current Mithril era.
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_certificate_verifier_cache(
self,
certificate_verifier_cache: Option<Arc<dyn CertificateVerifierCache>>,
) -> ClientBuilder
Available on crate feature unstable only.
pub fn with_certificate_verifier_cache( self, certificate_verifier_cache: Option<Arc<dyn CertificateVerifierCache>>, ) -> ClientBuilder
unstable only.Set the CertificateVerifierCache that will be used to cache certificate validation results.
Passing a None value will disable the cache if any was previously set.
Sourcepub fn with_http_file_downloader(
self,
http_file_downloader: Arc<dyn FileDownloader>,
) -> ClientBuilder
Available on crate feature fs only.
pub fn with_http_file_downloader( self, http_file_downloader: Arc<dyn FileDownloader>, ) -> ClientBuilder
fs only.Set the FileDownloader that will be used to download artifacts with HTTP.
Sourcepub fn set_ancillary_verification_key<T: Into<Option<String>>>(
self,
ancillary_verification_key: T,
) -> ClientBuilder
Available on crate feature fs only.
pub fn set_ancillary_verification_key<T: Into<Option<String>>>( self, ancillary_verification_key: T, ) -> ClientBuilder
fs only.Set the ancillary verification key to use when verifying the downloaded ancillary files.
Sourcepub fn with_logger(self, logger: Logger) -> Self
pub fn with_logger(self, logger: Logger) -> Self
Set the Logger to use.
Sourcepub fn with_origin_tag(self, origin_tag: Option<String>) -> Self
pub fn with_origin_tag(self, origin_tag: Option<String>) -> Self
Set the origin tag.
Sourcepub fn with_client_type(self, client_type: Option<String>) -> Self
pub fn with_client_type(self, client_type: Option<String>) -> Self
Set the client type.
Sourcepub fn with_options(self, options: ClientOptions) -> Self
pub fn with_options(self, options: ClientOptions) -> Self
Sets the options to be used by the client.
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).
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more