pub struct LinkStore { /* private fields */ }Expand description
A persisted link pointer, mirror, and revocation store.
Owns the stable-link rows of an IndexingDatabase and keeps a hydrated
LinkResolver in sync so CLI handlers only render results.
Implementations§
Source§impl LinkStore
impl LinkStore
Sourcepub fn with_database(database: IndexingDatabase) -> Result<Self>
pub fn with_database(database: IndexingDatabase) -> Result<Self>
Open a link store backed by an existing indexing database.
§Errors
Returns an error if the persisted links cannot be read.
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open a link store backed by the database at path.
§Errors
Returns an error if the database cannot be opened or its links read.
Sourcepub const fn database(&self) -> &IndexingDatabase
pub const fn database(&self) -> &IndexingDatabase
Return the underlying indexing database.
Sourcepub const fn resolver(&self) -> &LinkResolver
pub const fn resolver(&self) -> &LinkResolver
Return the hydrated resolver.
Sourcepub const fn create_content_link(&self, hash: Hash) -> Link
pub const fn create_content_link(&self, hash: Hash) -> Link
Create an immutable content link.
Sourcepub fn create_private_link(
&self,
hash: Hash,
expires: Option<u64>,
) -> Result<Link>
pub fn create_private_link( &self, hash: Hash, expires: Option<u64>, ) -> Result<Link>
Create a private capability link and clear any stale revocation.
§Errors
Returns an error if the capability cannot be generated or persisted.
Sourcepub fn create_named_link(
&self,
identity: &IdentityManager,
alias_input: impl Into<String>,
hash: Hash,
version: Option<String>,
sequence: u64,
) -> Result<Link>
pub fn create_named_link( &self, identity: &IdentityManager, alias_input: impl Into<String>, hash: Hash, version: Option<String>, sequence: u64, ) -> Result<Link>
Create and sign a mutable name link, advancing the pointer sequence.
With sequence == 0 the next sequence is derived from the persisted
pointer history for the same publisher and alias.
§Errors
Returns an error if the pointer is invalid, cannot be signed, or is not monotonically newer than the current pointer.
Sourcepub fn revoke(&self, private: &PrivateLink) -> Result<()>
pub fn revoke(&self, private: &PrivateLink) -> Result<()>
Revoke a private capability and persist the revocation.
§Errors
Returns an error if the link is invalid or cannot be persisted.
Sourcepub fn register_mirror(&self, ticket: BlobTicket) -> Result<()>
pub fn register_mirror(&self, ticket: BlobTicket) -> Result<()>
Register a provider ticket as a mirror for its content hash.
§Errors
Returns an error if the ticket is malformed or cannot be persisted.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LinkStore
impl !UnwindSafe for LinkStore
impl Freeze for LinkStore
impl Send for LinkStore
impl Sync for LinkStore
impl Unpin for LinkStore
impl UnsafeUnpin for LinkStore
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