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 ( ...@@ -6,6 +6,7 @@ import (
"context" "context"
"errors" "errors"
"io" "io"
"time"
options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" options "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
...@@ -27,6 +28,11 @@ type Path interface { ...@@ -27,6 +28,11 @@ type Path interface {
type Node ipld.Node type Node ipld.Node
type Link ipld.Link type Link ipld.Link
type IpnsEntry struct {
Name string
Value Path
}
type Reader interface { type Reader interface {
io.ReadSeeker io.ReadSeeker
io.Closer io.Closer
...@@ -37,6 +43,7 @@ type CoreAPI interface { ...@@ -37,6 +43,7 @@ type CoreAPI interface {
// Unixfs returns an implementation of Unixfs API // Unixfs returns an implementation of Unixfs API
Unixfs() UnixfsAPI Unixfs() UnixfsAPI
Dag() DagAPI Dag() DagAPI
Name() NameAPI
// 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)
...@@ -90,6 +97,18 @@ type DagAPI interface { ...@@ -90,6 +97,18 @@ type DagAPI interface {
WithDepth(depth int) options.DagTreeOption 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 { // 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