pub struct LinkResolver { /* private fields */ }Expand description
In-memory resolver and mirror registry.
Implementations§
Source§impl LinkResolver
impl LinkResolver
Sourcepub fn register_mirror(&self, ticket: BlobTicket) -> Result<()>
pub fn register_mirror(&self, ticket: BlobTicket) -> Result<()>
Sourcepub fn add_mirror(&self, ticket: BlobTicket) -> Result<()>
pub fn add_mirror(&self, ticket: BlobTicket) -> Result<()>
Sourcepub fn register_provider_ticket(&self, ticket: BlobTicket) -> Result<()>
pub fn register_provider_ticket(&self, ticket: BlobTicket) -> Result<()>
Sourcepub fn register_provider_lease(&self, lease: ProviderLease) -> Result<()>
pub fn register_provider_lease(&self, lease: ProviderLease) -> Result<()>
Register a signed provider lease for a hash.
§Errors
Returns an error if the lease signature, expiry, or ticket is invalid.
Sourcepub fn mirrors(&self, hash: Hash) -> Result<Vec<BlobTicket>>
pub fn mirrors(&self, hash: Hash) -> Result<Vec<BlobTicket>>
Return registered direct mirror tickets in registration order.
§Errors
Returns an error if the resolver state lock is poisoned.
Sourcepub fn publish(&self, pointer: MutablePointer) -> Result<()>
pub fn publish(&self, pointer: MutablePointer) -> Result<()>
Accept a signed mutable pointer, enforcing monotonic sequence.
§Errors
Returns an error if the pointer is unsigned, invalid, or older than the current pointer.
Sourcepub fn register_pointer(&self, pointer: MutablePointer) -> Result<()>
pub fn register_pointer(&self, pointer: MutablePointer) -> Result<()>
Sourcepub fn update(&self, pointer: MutablePointer) -> Result<()>
pub fn update(&self, pointer: MutablePointer) -> Result<()>
Sourcepub fn current_pointer(&self, link: &NameLink) -> Result<Option<MutablePointer>>
pub fn current_pointer(&self, link: &NameLink) -> Result<Option<MutablePointer>>
Return the current pointer for a mutable name.
§Errors
Returns an error if the link is invalid or the resolver state lock is poisoned.
Sourcepub fn revoke(&self, link: &PrivateLink) -> Result<()>
pub fn revoke(&self, link: &PrivateLink) -> Result<()>
Revoke a private capability.
§Errors
Returns an error if the link is invalid or the resolver state lock is poisoned.
Sourcepub fn revoke_private(&self, link: &PrivateLink) -> Result<()>
pub fn revoke_private(&self, link: &PrivateLink) -> Result<()>
Alias for Self::revoke.
§Errors
Returns an error if the link is invalid or the resolver state lock is poisoned.
Sourcepub fn is_revoked(&self, link: &PrivateLink) -> Result<bool>
pub fn is_revoked(&self, link: &PrivateLink) -> Result<bool>
Return whether a private capability has been revoked.
§Errors
Returns an error if the link is invalid or the resolver state lock is poisoned.
Sourcepub fn resolve(&self, link: &Link) -> Result<LinkResolution>
pub fn resolve(&self, link: &Link) -> Result<LinkResolution>
Resolve a link using the current time.
§Errors
Returns an error if the link is invalid, unavailable, expired, revoked, or has an invalid provider.
Sourcepub fn resolve_at(&self, link: &Link, now: u64) -> Result<LinkResolution>
pub fn resolve_at(&self, link: &Link, now: u64) -> Result<LinkResolution>
Resolve a link at an explicit timestamp.
§Errors
Returns an error if the link is invalid, unavailable, expired, revoked, or has an invalid provider.
Sourcepub fn resolve_version(
&self,
link: &NameLink,
version: &str,
) -> Result<LinkResolution>
pub fn resolve_version( &self, link: &NameLink, version: &str, ) -> Result<LinkResolution>
Resolve a mutable link to an exact semantic version.
§Errors
Returns an error if the link or requested version is unavailable.
Sourcepub fn resolve_with_options(
&self,
link: &Link,
options: &ResolveOptions,
) -> Result<LinkResolution>
pub fn resolve_with_options( &self, link: &Link, options: &ResolveOptions, ) -> Result<LinkResolution>
Resolve a link using explicit version and expiry options.
§Errors
Returns an error if the link is invalid, unavailable, expired, revoked, or has an invalid provider.
Sourcepub fn resolve_uri(&self, uri: &str) -> Result<LinkResolution>
pub fn resolve_uri(&self, uri: &str) -> Result<LinkResolution>
Parse and resolve a link URI.
§Errors
Returns an error if the URI cannot be parsed or the link cannot be resolved.
Sourcepub fn fetch_with_mirrors<T, Fetch>(
&self,
link: &Link,
fetch: Fetch,
) -> Result<T>
pub fn fetch_with_mirrors<T, Fetch>( &self, link: &Link, fetch: Fetch, ) -> Result<T>
Resolve and fetch a link, trying each provider and mirror in order.
§Errors
Returns the first successful fetch result, or an error if resolution fails or every provider fails.
Trait Implementations§
Source§impl Clone for LinkResolver
impl Clone for LinkResolver
Source§fn clone(&self) -> LinkResolver
fn clone(&self) -> LinkResolver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LinkResolver
impl Debug for LinkResolver
Source§impl Default for LinkResolver
impl Default for LinkResolver
Source§fn default() -> LinkResolver
fn default() -> LinkResolver
Auto Trait Implementations§
impl Freeze for LinkResolver
impl RefUnwindSafe for LinkResolver
impl Send for LinkResolver
impl Sync for LinkResolver
impl Unpin for LinkResolver
impl UnsafeUnpin for LinkResolver
impl UnwindSafe for LinkResolver
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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