Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
interface-go-dms3-core
Commits
52f5b7ce
Commit
52f5b7ce
authored
Dec 14, 2017
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi: Basic object API implementation
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
2c3137f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
21 deletions
+23
-21
interface.go
interface.go
+23
-21
No files found.
interface.go
View file @
52f5b7ce
...
...
@@ -191,27 +191,29 @@ type KeyAPI interface {
Remove
(
ctx
context
.
Context
,
name
string
)
(
Path
,
error
)
}
// type ObjectAPI interface {
// New() (cid.Cid, Object)
// Get(string) (Object, error)
// Links(string) ([]*Link, error)
// Data(string) (Reader, error)
// Stat(string) (ObjectStat, error)
// Put(Object) (cid.Cid, error)
// SetData(string, Reader) (cid.Cid, error)
// AppendData(string, Data) (cid.Cid, error)
// AddLink(string, string, string) (cid.Cid, error)
// RmLink(string, string) (cid.Cid, error)
// }
// type ObjectStat struct {
// Cid cid.Cid
// NumLinks int
// BlockSize int
// LinksSize int
// DataSize int
// CumulativeSize int
// }
//TODO: Should this use paths instead of cids?
type
ObjectAPI
interface
{
New
(
ctx
context
.
Context
)
(
Node
,
error
)
Put
(
context
.
Context
,
Node
)
error
Get
(
context
.
Context
,
Path
)
(
Node
,
error
)
Data
(
context
.
Context
,
Path
)
(
io
.
Reader
,
error
)
Links
(
context
.
Context
,
Path
)
([]
*
Link
,
error
)
Stat
(
context
.
Context
,
Path
)
(
*
ObjectStat
,
error
)
AddLink
(
ctx
context
.
Context
,
base
Path
,
name
string
,
child
Path
,
create
bool
)
(
Node
,
error
)
//TODO: make create optional
RmLink
(
context
.
Context
,
Path
,
string
)
(
Node
,
error
)
AppendData
(
context
.
Context
,
Path
,
io
.
Reader
)
(
Node
,
error
)
SetData
(
context
.
Context
,
Path
,
io
.
Reader
)
(
Node
,
error
)
}
type
ObjectStat
struct
{
Cid
*
cid
.
Cid
NumLinks
int
BlockSize
int
LinksSize
int
DataSize
int
CumulativeSize
int
}
var
ErrIsDir
=
errors
.
New
(
"object is a directory"
)
var
ErrOffline
=
errors
.
New
(
"can't resolve, ipfs node is offline"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment