coreapi: add tests for dag
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com> This commit was moved from ipfs/interface-go-ipfs-core@c593c49d857c407d9e3b6a5576f2cdb5a1fe1e97 This commit was moved from ipfs/boxo@b0b4e68ff7103e39dd2698db9877b96978bc3ec4
Łukasz Magiera committed
Dec 11, 2017 at 17:22 UTC
363c556e23c5ae12c40fda53fac95500f295f1a9
1 file changed
+10
-2
core/coreiface/interface.go
+10
-2
@@ -41,7 +41,7 @@ type CoreAPI interface {
41
42
// ResolveNode resolves the path (if not resolved already) using Unixfs
43
// resolver, gets and returns the resolved Node
44
- ResolveNode(context.Context, Path) (Node, error) //TODO: should this get dropped in favor of DagAPI.Get?
44
+ ResolveNode(context.Context, Path) (Node, error)
45
}
46
47
// UnixfsAPI is the basic interface to immutable files in IPFS
@@ -56,9 +56,17 @@ type UnixfsAPI interface {
56
Ls(context.Context, Path) ([]*Link, error)
57
}
58
59
+// DagAPI specifies the interface to IPLD
60
type DagAPI interface {
60
- Put(ctx context.Context, src io.Reader, inputEnc string, format *cid.Prefix) ([]Node, error)
61
+ // Put inserts data using specified format and input encoding.
62
+ // If format is not specified (nil), default dag-cbor/sha256 is used
63
+ Put(ctx context.Context, src io.Reader, inputEnc string, format *cid.Prefix) ([]Node, error) //TODO: make format optional
64
+
65
+ // Get attempts to resolve and get the node specified by the path
66
Get(ctx context.Context, path Path) (Node, error)
67
+
68
+ // Tree returns list of paths within a node specified by the path.
69
+ // To get all paths in a tree, set depth to -1
70
Tree(ctx context.Context, path Path, depth int) ([]Path, error)
71
}
72