[][src]Struct ipfs_embed_core::Transaction

pub struct Transaction<S> { /* fields omitted */ }

An atomic store transaction.

Implementations

impl<S> Transaction<S> where
    S: StoreParams
[src]

pub fn new() -> Transaction<S>[src]

Creates a new transaction.

pub fn with_capacity(capacity: usize) -> Transaction<S>[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<(), Error> where
    Ipld: Decode<<S as StoreParams>::Codecs>, 
[src]

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<(), Error> where
    Ipld: Decode<<S as StoreParams>::Codecs>, 
[src]

Inserts a block.

This will add the block to the end of the transaction.

pub fn create<CE, T>(
    &mut self,
    codec: CE,
    hash: u64,
    value: &T
) -> Result<Cid, Error> where
    CE: Codec + Into<<S as StoreParams>::Codecs>,
    T: Encode<CE> + ?Sized,
    Ipld: Decode<<S as StoreParams>::Codecs>, 
[src]

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> Default for Transaction<S> where
    S: StoreParams
[src]

impl<S> IntoIterator for Transaction<S> where
    S: StoreParams
[src]

type Item = Op<S>

The type of the elements being iterated over.

type IntoIter = IntoIter<<Transaction<S> as IntoIterator>::Item>

Which kind of iterator are we turning this into?

impl<'a, S> IntoIterator for &'a Transaction<S> where
    S: StoreParams
[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?

Auto Trait Implementations

impl<S> RefUnwindSafe for Transaction<S> where
    S: RefUnwindSafe

impl<S> Send for Transaction<S> where
    S: Send

impl<S> Sync for Transaction<S> where
    S: Sync

impl<S> Unpin for Transaction<S> where
    S: Unpin

impl<S> UnwindSafe for Transaction<S> where
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

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?

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,