pub struct IpldDag<Types: RepoTypes> { /* private fields */ }
Expand description
ipfs.dag
interface providing wrapper around Ipfs.
Implementations§
source§impl<Types: RepoTypes> IpldDag<Types>
impl<Types: RepoTypes> IpldDag<Types>
sourcepub async fn put(
&self,
codec: IpldCodec,
data: Ipld,
opt: Option<DagOpt>
) -> Result<Cid, Error>
pub async fn put(
&self,
codec: IpldCodec,
data: Ipld,
opt: Option<DagOpt>
) -> 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) -> Result<Ipld, ResolveError>
pub async fn get(&self, path: IpfsPath) -> 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
) -> Result<(ResolvedNode, SlashedPath), ResolveError>
pub async fn resolve(
&self,
path: IpfsPath,
follow_links: 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.