pub struct IpldDag { /* private fields */ }
Expand description
ipfs.dag
interface providing wrapper around Ipfs.
Implementations§
source§impl IpldDag
impl IpldDag
sourcepub fn put_dag(&self, ipld: Ipld) -> DagPut
pub fn put_dag(&self, ipld: Ipld) -> 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.