Commit 1b5e997c authored by Łukasz Magiera's avatar Łukasz Magiera

coreapi: Name API proposal

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent 20fa7a59
......@@ -6,6 +6,7 @@ import (
"context"
"errors"
"io"
"time"
options "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
......@@ -27,6 +28,11 @@ type Path interface {
type Node ipld.Node
type Link ipld.Link
type IpnsEntry struct {
Name string
Value Path
}
type Reader interface {
io.ReadSeeker
io.Closer
......@@ -37,6 +43,7 @@ type CoreAPI interface {
// Unixfs returns an implementation of Unixfs API
Unixfs() UnixfsAPI
Dag() DagAPI
Name() NameAPI
// ResolvePath resolves the path using Unixfs resolver
ResolvePath(context.Context, Path) (Path, error)
......@@ -90,6 +97,18 @@ type DagAPI interface {
WithDepth(depth int) options.DagTreeOption
}
type NameAPI interface {
Publish(ctx context.Context, path Path, validTime time.Duration, key string) (*IpnsEntry, error)
Resolve(ctx context.Context, name string, recursive bool, local bool, nocache bool) (Path, error)
}
type KeyApi interface {
Generate(ctx context.Context, name string, algorithm string, size int) error
List(ctx context.Context) (map[string]string, error) //TODO: better key type?
Rename(ctx context.Context, oldName string, newName string) error
Remove(ctx context.Context, name string) error
}
// type ObjectAPI interface {
// New() (cid.Cid, Object)
// 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