@cryptotaxi247 / kubo / commits / 71593fb48

coreapi: Name API proposal

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com> This commit was moved from ipfs/interface-go-ipfs-core@1b5e997ca845b58519a3592db60c78d4ec7efdc8 This commit was moved from ipfs/boxo@8972ab9e110214d72b9c048240ac75e33bd69248

Łukasz Magiera committed Dec 10, 2017 at 23:15 UTC 71593fb48cd8b6b4bc7590d7b1cfa8b662ef611d
1 file changed +19
core/coreiface/interface.go
+19
@@ -6,6 +6,7 @@ import (
6 "context"
7 "errors"
8 "io"
9 + "time"
10
11 options "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
12
@@ -27,6 +28,11 @@ type Path interface {
28 type Node ipld.Node
29 type Link ipld.Link
30
31 +type IpnsEntry struct {
32 + Name string
33 + Value Path
34 +}
35 +
36 type Reader interface {
37 io.ReadSeeker
38 io.Closer
@@ -37,6 +43,7 @@ type CoreAPI interface {
43 // Unixfs returns an implementation of Unixfs API
44 Unixfs() UnixfsAPI
45 Dag() DagAPI
46 + Name() NameAPI
47
48 // ResolvePath resolves the path using Unixfs resolver
49 ResolvePath(context.Context, Path) (Path, error)
@@ -90,6 +97,18 @@ type DagAPI interface {
97 WithDepth(depth int) options.DagTreeOption
98 }
99
100 +type NameAPI interface {
101 + Publish(ctx context.Context, path Path, validTime time.Duration, key string) (*IpnsEntry, error)
102 + Resolve(ctx context.Context, name string, recursive bool, local bool, nocache bool) (Path, error)
103 +}
104 +
105 +type KeyApi interface {
106 + Generate(ctx context.Context, name string, algorithm string, size int) error
107 + List(ctx context.Context) (map[string]string, error) //TODO: better key type?
108 + Rename(ctx context.Context, oldName string, newName string) error
109 + Remove(ctx context.Context, name string) error
110 +}
111 +
112 // type ObjectAPI interface {
113 // New() (cid.Cid, Object)
114 // Get(string) (Object, error)