pub struct BlockingClient { /* private fields */ }Expand description
A synchronous client with a hard per-call deadline. See the module docs.
Implementations§
Source§impl BlockingClient
impl BlockingClient
Sourcepub fn new(
client: RegistryClient,
resolver: WebResolver,
) -> Result<Self, AcdpError>
pub fn new( client: RegistryClient, resolver: WebResolver, ) -> Result<Self, AcdpError>
Wrap client (the registry every call goes to) and resolver
(DID resolution for verification), with
DEFAULT_WORKER_THREADS runtime workers.
Sourcepub fn with_worker_threads(
client: RegistryClient,
resolver: WebResolver,
worker_threads: usize,
) -> Result<Self, AcdpError>
pub fn with_worker_threads( client: RegistryClient, resolver: WebResolver, worker_threads: usize, ) -> Result<Self, AcdpError>
As Self::new, with worker_threads runtime workers (at least
one). More workers let more concurrent calls verify signatures in
parallel; network waits do not need them.
Sourcepub fn with_cross_registry(self, resolver: CrossRegistryResolver) -> Self
pub fn with_cross_registry(self, resolver: CrossRegistryResolver) -> Self
Enable Self::resolve with resolver. The result shares this
client’s runtime; clones made before the call keep their previous
configuration.
Sourcepub fn client(&self) -> &RegistryClient
pub fn client(&self) -> &RegistryClient
The wrapped registry client.
Sourcepub fn resolver(&self) -> &WebResolver
pub fn resolver(&self) -> &WebResolver
The wrapped DID resolver.
Sourcepub fn run<T, F, Fut>(&self, deadline: Instant, f: F) -> Result<T, AcdpError>
pub fn run<T, F, Fut>(&self, deadline: Instant, f: F) -> Result<T, AcdpError>
Run any future against the wrapped clients under deadline. The
escape hatch for async APIs without a dedicated method: f
receives a handle to this client and returns the future to run.
let caps = c.run(Instant::now() + Duration::from_secs(1), |c| async move {
c.client().capabilities().await
})?;Sourcepub fn retrieve(
&self,
ctx_id: &CtxId,
deadline: Instant,
) -> Result<FullContext, AcdpError>
pub fn retrieve( &self, ctx_id: &CtxId, deadline: Instant, ) -> Result<FullContext, AcdpError>
RegistryClient::retrieve: the context as served, unverified.
Sourcepub fn fetch_verified(
&self,
ctx_id: &CtxId,
policy: &VerificationPolicy,
deadline: Instant,
) -> Result<VerifiedContext, AcdpError>
pub fn fetch_verified( &self, ctx_id: &CtxId, policy: &VerificationPolicy, deadline: Instant, ) -> Result<VerifiedContext, AcdpError>
VerifiedContext::fetch_with_policy: retrieve and verify.
Sourcepub fn fetch_current_verified(
&self,
lineage_id: &LineageId,
policy: &VerificationPolicy,
deadline: Instant,
) -> Result<VerifiedContext, AcdpError>
pub fn fetch_current_verified( &self, lineage_id: &LineageId, policy: &VerificationPolicy, deadline: Instant, ) -> Result<VerifiedContext, AcdpError>
VerifiedContext::fetch_current_with_policy: retrieve and verify
a lineage’s current head.
Sourcepub fn resolve(
&self,
ctx_id: &CtxId,
deadline: Instant,
) -> Result<VerifiedContext, AcdpError>
pub fn resolve( &self, ctx_id: &CtxId, deadline: Instant, ) -> Result<VerifiedContext, AcdpError>
CrossRegistryResolver::resolve: resolve and verify a context at
whichever registry ctx_id names. Requires
Self::with_cross_registry; otherwise fails with
AcdpError::SchemaViolation without issuing a request.
Sourcepub fn changes(
&self,
since: &Since,
filter: &WatchFilter,
limit: Option<u32>,
deadline: Instant,
) -> Result<ChangesResponse, AcdpError>
pub fn changes( &self, since: &Since, filter: &WatchFilter, limit: Option<u32>, deadline: Instant, ) -> Result<ChangesResponse, AcdpError>
RegistryClient::changes: one page of the changes feed. Entries
are hints until Self::verify_change passes.
Sourcepub fn verify_change(
&self,
change: &Change,
held: Option<HeldContext<'_>>,
policy: &VerificationPolicy,
deadline: Instant,
) -> Result<ChangeVerdict, AcdpError>
pub fn verify_change( &self, change: &Change, held: Option<HeldContext<'_>>, policy: &VerificationPolicy, deadline: Instant, ) -> Result<ChangeVerdict, AcdpError>
verify_change (RFC-ACDP-0018 §7). held is copied, so the
borrow ends when this returns. Ok(Rejected) is a final verdict;
Err (including AcdpError::DeadlineExceeded) means the entry
was not decided and should be retried.