pub struct Transaction<'a, S> { /* private fields */ }
Implementations§
Source§impl<'a, S> Transaction<'a, S>
impl<'a, S> Transaction<'a, S>
Sourcepub fn alias<'b>(
&mut self,
name: impl Into<Cow<'b, [u8]>>,
link: Option<&'b Cid>,
) -> Result<()>
pub fn alias<'b>( &mut self, name: impl Into<Cow<'b, [u8]>>, link: Option<&'b Cid>, ) -> Result<()>
Set or delete an alias
Sourcepub fn reverse_alias(&mut self, cid: &Cid) -> Result<Option<HashSet<Vec<u8>>>>
pub fn reverse_alias(&mut self, cid: &Cid) -> Result<Option<HashSet<Vec<u8>>>>
Returns the aliases referencing a cid.
Sourcepub fn resolve<'b>(
&mut self,
name: impl Into<Cow<'b, [u8]>>,
) -> Result<Option<Cid>>
pub fn resolve<'b>( &mut self, name: impl Into<Cow<'b, [u8]>>, ) -> Result<Option<Cid>>
Resolves an alias to a cid.
Sourcepub fn temp_pin(&mut self) -> TempPin
pub fn temp_pin(&mut self) -> TempPin
Get a temporary pin for safely adding blocks to the store
Sourcepub fn extend_temp_pin(&mut self, pin: &mut TempPin, link: &Cid) -> Result<()>
pub fn extend_temp_pin(&mut self, pin: &mut TempPin, link: &Cid) -> Result<()>
Extend temp pin with an additional cid
Sourcepub fn has_cid(&mut self, cid: &Cid) -> Result<bool>
pub fn has_cid(&mut self, cid: &Cid) -> Result<bool>
Checks if the store knows about the cid.
Note that this does not necessarily mean that the store has the data for the cid.
Sourcepub fn has_block(&mut self, cid: &Cid) -> Result<bool>
pub fn has_block(&mut self, cid: &Cid) -> Result<bool>
Checks if the store has the data for a cid
Sourcepub fn get_known_cids<C: FromIterator<Cid>>(&mut self) -> Result<C>
pub fn get_known_cids<C: FromIterator<Cid>>(&mut self) -> Result<C>
Get all cids that the store knows about
Sourcepub fn get_block_cids<C: FromIterator<Cid>>(&mut self) -> Result<C>
pub fn get_block_cids<C: FromIterator<Cid>>(&mut self) -> Result<C>
Get all cids for which the store has blocks
Sourcepub fn get_descendants<C: FromIterator<Cid>>(&mut self, cid: &Cid) -> Result<C>
pub fn get_descendants<C: FromIterator<Cid>>(&mut self, cid: &Cid) -> Result<C>
Get descendants of a cid
Sourcepub fn get_missing_blocks<C: FromIterator<Cid>>(
&mut self,
cid: &Cid,
) -> Result<C>
pub fn get_missing_blocks<C: FromIterator<Cid>>( &mut self, cid: &Cid, ) -> Result<C>
Given a root of a dag, gives all cids which we do not have data for.
Sourcepub fn put_block(
&mut self,
block: Block<S>,
pin: Option<&mut TempPin>,
) -> Result<()>
pub fn put_block( &mut self, block: Block<S>, pin: Option<&mut TempPin>, ) -> Result<()>
Put a block. This will only be completed once the transaction is successfully committed
Sourcepub fn get_store_stats(&mut self) -> Result<StoreStats>
pub fn get_store_stats(&mut self) -> Result<StoreStats>
Get the stats for the store.
The stats are kept up to date, so this is fast.
Auto Trait Implementations§
impl<'a, S> Freeze for Transaction<'a, S>
impl<'a, S> !RefUnwindSafe for Transaction<'a, S>
impl<'a, S> Send for Transaction<'a, S>where
S: Send,
impl<'a, S> !Sync for Transaction<'a, S>
impl<'a, S> Unpin for Transaction<'a, S>where
S: Unpin,
impl<'a, S> !UnwindSafe for Transaction<'a, S>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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