[−][src]Struct ipld_block_builder::BlockBuilder
Generic block builder for creating blocks.
Implementations
impl<S, C> BlockBuilder<S, C>[src]
pub fn new(store: S, codec: C) -> Self[src]
Creates a builder for public blocks.
pub fn visibility(&self) -> Visibility[src]
Gets the visibility of the builder.
pub fn store(&self) -> &S[src]
Gets the store of the builder.
pub fn codec(&self) -> &C[src]
Gets the codec of the builder.
impl<S, C: Encrypted> BlockBuilder<S, C>[src]
pub fn new_private(store: S, codec: C) -> Self[src]
Creates a builder for private blocks.
impl<S: ReadonlyStore, C: Decoder> BlockBuilder<S, C>[src]
pub async fn get<'_, '_, D: Decode<C::Codec>>(
&'_ self,
cid: &'_ Cid
) -> Result<D>[src]
&'_ self,
cid: &'_ Cid
) -> Result<D>
Returns the decoded block with cid.
impl<S: ReadonlyStore, C: IpldDecoder> BlockBuilder<S, C>[src]
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]
&'_ self,
path: &'_ DagPath<'_>
) -> Result<Ipld>
Resolves a path recursively and returns the ipld.
impl<S: Store, C: Encoder + Clone> BlockBuilder<S, C>[src]
pub fn create_batch(&self) -> Batch<C>[src]
Creates a new batch.
pub fn create_batch_with_capacity(&self, capacity: usize) -> Batch<C>[src]
Creates a new batch with capacity.
pub async fn insert<'_, '_, E: Encode<C::Codec>>(
&'_ self,
e: &'_ E
) -> Result<Cid>[src]
&'_ self,
e: &'_ E
) -> Result<Cid>
Encodes and inserts a block into the store.
pub async fn insert_batch<'_, T>(&'_ self, batch: Batch<T>) -> Result<Cid>[src]
Inserts a batch of blocks atomically pinning the last one.
impl<S: Store, C> BlockBuilder<S, C>[src]
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, C> BlockBuilder<S, C>[src]
pub async fn pin<'_, '_, '_>(
&'_ self,
cid: &'_ Cid,
path: &'_ Path
) -> Result<()>[src]
&'_ self,
cid: &'_ Cid,
path: &'_ Path
) -> Result<()>
Pins a block in the store.
impl<S: AliasStore, C> BlockBuilder<S, C>[src]
pub async fn alias<'_, '_, '_>(
&'_ self,
alias: &'_ [u8],
cid: &'_ Cid
) -> Result<()>[src]
&'_ self,
alias: &'_ [u8],
cid: &'_ Cid
) -> Result<()>
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.
Auto Trait Implementations
impl<S, C> RefUnwindSafe for BlockBuilder<S, C> where
C: RefUnwindSafe,
S: RefUnwindSafe,
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, C> Send for BlockBuilder<S, C> where
C: Send,
S: Send,
C: Send,
S: Send,
impl<S, C> Sync for BlockBuilder<S, C> where
C: Sync,
S: Sync,
C: Sync,
S: Sync,
impl<S, C> Unpin for BlockBuilder<S, C> where
C: Unpin,
S: Unpin,
C: Unpin,
S: Unpin,
impl<S, C> UnwindSafe for BlockBuilder<S, C> where
C: UnwindSafe,
S: UnwindSafe,
C: 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<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>,