coreapi: DAG API proposal
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com> This commit was moved from ipfs/interface-go-ipfs-core@c6015845cbf43a2b9fc83d749137bee10f9d6396 This commit was moved from ipfs/boxo@b351a5a73c7db7a1dbbbffe546f76563c91c2fa5
Łukasz Magiera committed
Dec 8, 2017 at 22:51 UTC
3051f3b60123d981b25e88dd45651064ac9a8511
1 file changed
+8
-1
core/coreiface/interface.go
+8
-1
@@ -34,13 +34,14 @@ type Reader interface {
34
type CoreAPI interface {
35
// Unixfs returns an implementation of Unixfs API
36
Unixfs() UnixfsAPI
37
+ Dag() DagAPI
38
39
// ResolvePath resolves the path using Unixfs resolver
40
ResolvePath(context.Context, Path) (Path, error)
41
42
// ResolveNode resolves the path (if not resolved already) using Unixfs
43
// resolver, gets and returns the resolved Node
43
- ResolveNode(context.Context, Path) (Node, error)
44
+ ResolveNode(context.Context, Path) (Node, error) //TODO: should this get dropped in favor of DagAPI.Get?
45
}
46
47
// UnixfsAPI is the basic interface to immutable files in IPFS
@@ -55,6 +56,12 @@ type UnixfsAPI interface {
56
Ls(context.Context, Path) ([]*Link, error)
57
}
58
59
+type DagAPI interface {
60
+ Put(ctx context.Context, src io.Reader, inputEnc string, format *cid.Prefix) ([]Node, error)
61
+ Get(ctx context.Context, path Path) (Node, error)
62
+ Tree(ctx context.Context, path Path, depth int) ([]Path, error)
63
+}
64
+
65
// type ObjectAPI interface {
66
// New() (cid.Cid, Object)
67
// Get(string) (Object, error)