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
2fbdcd09
Commit
2fbdcd09
authored
Dec 15, 2017
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs/coreapi: Add some documentation to CoreAPI
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
6c6807b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
interface.go
interface.go
+17
-0
No files found.
interface.go
View file @
2fbdcd09
// Package iface defines IPFS Core API which is a set of interfaces used to
// interact with IPFS nodes.
package
iface
package
iface
import
(
import
(
...
@@ -9,6 +11,8 @@ import (
...
@@ -9,6 +11,8 @@ import (
ipld
"gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
ipld
"gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
)
)
// Path is a generic wrapper for paths used in the API. A path can be resolved
// to a CID using one of Resolve functions in the API.
type
Path
interface
{
type
Path
interface
{
String
()
string
String
()
string
Cid
()
*
cid
.
Cid
Cid
()
*
cid
.
Cid
...
@@ -26,15 +30,28 @@ type Reader interface {
...
@@ -26,15 +30,28 @@ type Reader interface {
io
.
Closer
io
.
Closer
}
}
// CoreAPI defines an unified interface to IPFS for Go programs.
type
CoreAPI
interface
{
type
CoreAPI
interface
{
// Unixfs returns an implementation of Unixfs API
Unixfs
()
UnixfsAPI
Unixfs
()
UnixfsAPI
// 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
// resolver, gets and returns the resolved Node
ResolveNode
(
context
.
Context
,
Path
)
(
Node
,
error
)
ResolveNode
(
context
.
Context
,
Path
)
(
Node
,
error
)
}
}
// UnixfsAPI is the basic interface to immutable files in IPFS
type
UnixfsAPI
interface
{
type
UnixfsAPI
interface
{
// Add imports the data from the reader into merkledag file
Add
(
context
.
Context
,
io
.
Reader
)
(
Path
,
error
)
Add
(
context
.
Context
,
io
.
Reader
)
(
Path
,
error
)
// Cat returns a reader for the file
Cat
(
context
.
Context
,
Path
)
(
Reader
,
error
)
Cat
(
context
.
Context
,
Path
)
(
Reader
,
error
)
// Ls returns the list of links in a directory
Ls
(
context
.
Context
,
Path
)
([]
*
Link
,
error
)
Ls
(
context
.
Context
,
Path
)
([]
*
Link
,
error
)
}
}
...
...
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