[][src]Struct ipld_block_builder::GenericBlockBuilder

pub struct GenericBlockBuilder<S, H: Multihasher<Code>, C: Codec> { /* fields omitted */ }

Generic block builder for creating blocks.

Implementations

impl<S, H: Multihasher<Code>, C: Codec> GenericBlockBuilder<S, H, C>[src]

pub fn new(store: S) -> Self[src]

Creates a builder for public blocks.

impl<S: ReadonlyStore, H: Multihasher<Code>, C: Codec> GenericBlockBuilder<S, H, C>[src]

pub async fn get<'_, '_, D: Decode<C>>(&'_ self, cid: &'_ Cid) -> Result<D>[src]

Returns the decoded block with cid.

pub async fn get_ipld<'_, '_>(&'_ self, cid: &'_ Cid) -> Result<Ipld>[src]

Returns the ipld representation of a block with cid.

pub async fn get_path<'_, '_, '_>(
    &'_ self,
    path: &'_ DagPath<'_>
) -> Result<Ipld>
[src]

Resolves a path recursively and returns the ipld.

impl<S: Store, H: Multihasher<Code>, C: Codec> GenericBlockBuilder<S, H, C>[src]

pub async fn insert<'_, '_, E: Encode<C>>(&'_ self, e: &'_ E) -> Result<Cid>[src]

Encodes and inserts a block into the store.

pub async fn flush<'_>(&'_ self) -> Result<()>[src]

Flushes the store to disk.

pub async fn unpin<'_, '_>(&'_ self, cid: &'_ Cid) -> Result<()>[src]

Unpins a block from the store marking it ready for garbage collection.

impl<S: MultiUserStore, H: Multihasher<Code>, C: Codec> GenericBlockBuilder<S, H, C>[src]

pub async fn pin<'_, '_, '_>(
    &'_ self,
    cid: &'_ Cid,
    path: &'_ Path
) -> Result<()>
[src]

Pins a block in the store.

impl<S: AliasStore, H: Multihasher<Code>, C: Codec> GenericBlockBuilder<S, H, C>[src]

pub async fn alias<'_, '_, '_>(
    &'_ self,
    alias: &'_ [u8],
    cid: &'_ Cid
) -> Result<()>
[src]

Creates an alias for a cid.

pub async fn unalias<'_, '_>(&'_ self, alias: &'_ [u8]) -> Result<()>[src]

Removes an alias.

pub async fn resolve<'_, '_>(&'_ self, alias: &'_ [u8]) -> Result<Option<Cid>>[src]

Resolves an alias.

Trait Implementations

impl<S, H: Multihasher<Code>, C: Codec> Deref for GenericBlockBuilder<S, H, C>[src]

type Target = S

The resulting type after dereferencing.

impl<S, H: Multihasher<Code>, C: Codec> DerefMut for GenericBlockBuilder<S, H, C>[src]

Auto Trait Implementations

impl<S, H, C> RefUnwindSafe for GenericBlockBuilder<S, H, C> where
    C: RefUnwindSafe,
    H: RefUnwindSafe,
    S: RefUnwindSafe

impl<S, H, C> Send for GenericBlockBuilder<S, H, C> where
    C: Send,
    H: Send,
    S: Send

impl<S, H, C> Sync for GenericBlockBuilder<S, H, C> where
    C: Sync,
    H: Sync,
    S: Sync

impl<S, H, C> Unpin for GenericBlockBuilder<S, H, C> where
    C: Unpin,
    H: Unpin,
    S: Unpin

impl<S, H, C> UnwindSafe for GenericBlockBuilder<S, H, C> where
    C: UnwindSafe,
    H: UnwindSafe,
    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<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.