Commit c6015845 authored by Łukasz Magiera's avatar Łukasz Magiera

coreapi: DAG API proposal

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent 66117d4c
...@@ -34,13 +34,14 @@ type Reader interface { ...@@ -34,13 +34,14 @@ type Reader interface {
type CoreAPI interface { type CoreAPI interface {
// Unixfs returns an implementation of Unixfs API // Unixfs returns an implementation of Unixfs API
Unixfs() UnixfsAPI Unixfs() UnixfsAPI
Dag() DagAPI
// ResolvePath resolves the path using Unixfs resolver // ResolvePath resolves the path using Unixfs resolver
ResolvePath(context.Context, Path) (Path, error) ResolvePath(context.Context, Path) (Path, error)
// ResolveNode resolves the path (if not resolved already) using Unixfs // ResolveNode resolves the path (if not resolved already) using Unixfs
// resolver, gets and returns the resolved Node // resolver, gets and returns the resolved Node
ResolveNode(context.Context, Path) (Node, error) ResolveNode(context.Context, Path) (Node, error) //TODO: should this get dropped in favor of DagAPI.Get?
} }
// UnixfsAPI is the basic interface to immutable files in IPFS // UnixfsAPI is the basic interface to immutable files in IPFS
...@@ -55,6 +56,12 @@ type UnixfsAPI interface { ...@@ -55,6 +56,12 @@ type UnixfsAPI interface {
Ls(context.Context, Path) ([]*Link, error) Ls(context.Context, Path) ([]*Link, error)
} }
type DagAPI interface {
Put(ctx context.Context, src io.Reader, inputEnc string, format *cid.Prefix) ([]Node, error)
Get(ctx context.Context, path Path) (Node, error)
Tree(ctx context.Context, path Path, depth int) ([]Path, error)
}
// type ObjectAPI interface { // type ObjectAPI interface {
// New() (cid.Cid, Object) // New() (cid.Cid, Object)
// Get(string) (Object, error) // Get(string) (Object, error)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment