@cryptotaxi247 / kubo / commits / 704534e51

docs for coreapi dag method impls

License: MIT Signed-off-by: ForrestWeston <forrest@protocol.ai>

ForrestWeston committed Jan 22, 2018 at 14:43 UTC 704534e51c0a9cdca6379929ea98230b040c8a10
1 file changed +5
core/coreapi/dag.go
+5
@@ -19,6 +19,9 @@ type DagAPI struct {
19 *caopts.DagOptions
20 }
21
22 +// Put inserts data using specified format and input encoding. Unless used with
23 +// `WithCodes` or `WithHash`, the defaults "dag-cbor" and "sha256" are used.
24 +// Returns the path of the inserted data.
25 func (api *DagAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.DagPutOption) (coreiface.Path, error) {
26 settings, err := caopts.DagPutOptions(opts...)
27 if err != nil {
@@ -46,10 +49,12 @@ func (api *DagAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.DagPut
49 return ParseCid(nds[0].Cid()), nil
50 }
51
52 +// Get resolves `path` using Unixfs resolver, returns the resolved Node.
53 func (api *DagAPI) Get(ctx context.Context, path coreiface.Path) (coreiface.Node, error) {
54 return api.core().ResolveNode(ctx, path)
55 }
56
57 +// Tree returns list of paths within a node specified by the path `p`.
58 func (api *DagAPI) Tree(ctx context.Context, p coreiface.Path, opts ...caopts.DagTreeOption) ([]coreiface.Path, error) {
59 settings, err := caopts.DagTreeOptions(opts...)
60 if err != nil {