[−][src]Struct libipld::store::Transaction
An atomic store transaction.
Implementations
impl<S: StoreParams> Transaction<S>
[src]
pub fn new() -> Self
[src]
Creates a new transaction.
pub fn with_capacity(capacity: usize) -> Self
[src]
Creates a transaction with capacity.
pub fn is_empty(&self) -> bool
[src]
Is empty.
pub fn len(&self) -> usize
[src]
Len.
pub fn pin(&mut self, cid: Cid)
[src]
Increases the pin count of a block.
pub fn unpin(&mut self, cid: Cid)
[src]
Decreases the pin count of a block.
pub fn update(&mut self, old: Option<Cid>, new: Cid)
[src]
Update a block.
Pins the new block and unpins the old one.
pub fn import(&mut self, block: Block<S>) -> Result<()> where
Ipld: Decode<S::Codecs>,
[src]
Ipld: Decode<S::Codecs>,
Imports a block.
This will add the block to the front of the transaction.
When importing blocks from a network, they'll be fetched in reverse order. This ensures that when inserting the block all it's references have been inserted.
pub fn insert(&mut self, block: Block<S>) -> Result<()> where
Ipld: Decode<S::Codecs>,
[src]
Ipld: Decode<S::Codecs>,
Inserts a block.
This will add the block to the end of the transaction.
pub fn create<CE: Codec, T: Encode<CE> + ?Sized>(
&mut self,
codec: CE,
hash: u64,
value: &T
) -> Result<Cid> where
CE: Into<S::Codecs>,
Ipld: Decode<S::Codecs>,
[src]
&mut self,
codec: CE,
hash: u64,
value: &T
) -> Result<Cid> where
CE: Into<S::Codecs>,
Ipld: Decode<S::Codecs>,
Creates a block.
This will add the block to the end of the transaction.
When constructing blocks, the all references need to be created before the referrer.
Trait Implementations
impl<S: StoreParams> Default for Transaction<S>
[src]
impl<'a, S: StoreParams> IntoIterator for &'a Transaction<S>
[src]
type Item = &'a Op<S>
The type of the elements being iterated over.
type IntoIter = Iter<'a, Op<S>>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<S: StoreParams> IntoIterator for Transaction<S>
[src]
Auto Trait Implementations
impl<S> RefUnwindSafe for Transaction<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for Transaction<S> where
S: Send,
S: Send,
impl<S> Sync for Transaction<S> where
S: Sync,
S: Sync,
impl<S> Unpin for Transaction<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for Transaction<S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,