From 704534e51c0a9cdca6379929ea98230b040c8a10 Mon Sep 17 00:00:00 2001 From: ForrestWeston <forrest@protocol.ai> Date: Mon, 22 Jan 2018 14:43:42 -0800 Subject: [PATCH] docs for coreapi dag method impls License: MIT Signed-off-by: ForrestWeston <forrest@protocol.ai> --- core/coreapi/dag.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/coreapi/dag.go b/core/coreapi/dag.go index c5d59bc13..3a45fd0a4 100644 --- a/core/coreapi/dag.go +++ b/core/coreapi/dag.go @@ -19,6 +19,9 @@ type DagAPI struct { *caopts.DagOptions } +// Put inserts data using specified format and input encoding. Unless used with +// `WithCodes` or `WithHash`, the defaults "dag-cbor" and "sha256" are used. +// Returns the path of the inserted data. func (api *DagAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.DagPutOption) (coreiface.Path, error) { settings, err := caopts.DagPutOptions(opts...) if err != nil { @@ -46,10 +49,12 @@ func (api *DagAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.DagPut return ParseCid(nds[0].Cid()), nil } +// Get resolves `path` using Unixfs resolver, returns the resolved Node. func (api *DagAPI) Get(ctx context.Context, path coreiface.Path) (coreiface.Node, error) { return api.core().ResolveNode(ctx, path) } +// Tree returns list of paths within a node specified by the path `p`. func (api *DagAPI) Tree(ctx context.Context, p coreiface.Path, opts ...caopts.DagTreeOption) ([]coreiface.Path, error) { settings, err := caopts.DagTreeOptions(opts...) if err != nil { -- GitLab