pub struct IpldDag { /* private fields */ }
Expand description
ipfs.dag
interface providing wrapper around Ipfs.
Implementations§
source§impl IpldDag
impl IpldDag
sourcepub async fn put_dag(&self, ipld: Ipld) -> Result<Cid, Error>
pub async fn put_dag(&self, ipld: Ipld) -> Result<Cid, Error>
Puts an ipld node into the ipfs repo using dag-cbor
codec and Sha2_256 hash.
Returns Cid version 1 for the document
sourcepub async fn get_dag(&self, path: IpfsPath) -> Result<Ipld, Error>
pub async fn get_dag(&self, path: IpfsPath) -> Result<Ipld, Error>
Gets an ipld node from the ipfs, fetching the block if necessary.
See IpldDag::get
for more information.
sourcepub async fn put(
&self,
codec: IpldCodec,
data: Ipld,
opt: Option<DagPutOpt>
) -> Result<Cid, Error>
pub async fn put( &self, codec: IpldCodec, data: Ipld, opt: Option<DagPutOpt> ) -> Result<Cid, Error>
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 async fn get(
&self,
path: IpfsPath,
providers: &[PeerId],
local_only: bool
) -> Result<Ipld, ResolveError>
pub async fn get( &self, path: IpfsPath, providers: &[PeerId], local_only: bool ) -> Result<Ipld, ResolveError>
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.