pub struct IpldDag { /* private fields */ }
Expand description
ipfs.dag
interface providing wrapper around Ipfs.
Implementations§
Source§impl IpldDag
impl IpldDag
Sourcepub fn put_dag<S: Serialize>(&self, ipld: S) -> DagPut
pub fn put_dag<S: Serialize>(&self, ipld: S) -> DagPut
Puts an ipld node into the ipfs repo using dag-cbor
codec and Sha2_256 hash.
Returns Cid version 1 for the document
Sourcepub fn get_dag<I: Into<IpfsPath>>(&self, path: I) -> DagGet
pub fn get_dag<I: Into<IpfsPath>>(&self, path: I) -> DagGet
Gets an ipld node from the ipfs, fetching the block if necessary.
See IpldDag::get
for more information.
Sourcepub fn put(&self) -> DagPut
pub fn put(&self) -> DagPut
Returns the Cid
of a newly inserted block.
The block is created from the data
, encoded with the codec
and inserted into the repo.
Sourcepub fn get(&self) -> DagGet
pub fn get(&self) -> DagGet
Resolves a Cid
-rooted path to a document “node.”
Returns the resolved node as Ipld
.
Sourcepub async fn resolve(
&self,
path: IpfsPath,
follow_links: bool,
providers: &[PeerId],
local_only: bool,
) -> Result<(ResolvedNode, SlashedPath), ResolveError>
pub async fn resolve( &self, path: IpfsPath, follow_links: bool, providers: &[PeerId], local_only: bool, ) -> Result<(ResolvedNode, SlashedPath), ResolveError>
Resolves a Cid
-rooted path to a document “node.”
The return value has two kinds of meanings depending on whether links should be followed or not: when following links, the second returned value will be the path inside the last document; when not following links, the second returned value will be the unmatched or “remaining” path.
Regardless of the follow_links
option, HAMT-sharded directories will be resolved through
as a “single step” in the given IpfsPath.
Returns a node and the remaining path or the path inside the last document.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IpldDag
impl !RefUnwindSafe for IpldDag
impl Send for IpldDag
impl Sync for IpldDag
impl Unpin for IpldDag
impl !UnwindSafe for IpldDag
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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>
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>
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