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
go-dms3
Commits
219eae76
Commit
219eae76
authored
Jan 05, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi: draft block API
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
cb5bb7dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
core/coreapi/interface/interface.go
core/coreapi/interface/interface.go
+18
-0
core/coreapi/interface/options/block.go
core/coreapi/interface/options/block.go
+14
-0
No files found.
core/coreapi/interface/interface.go
View file @
219eae76
...
...
@@ -53,6 +53,11 @@ type Key interface {
Path
()
Path
}
type
BlockStat
interface
{
Size
()
int
Path
()
Path
}
// CoreAPI defines an unified interface to IPFS for Go programs.
type
CoreAPI
interface
{
// Unixfs returns an implementation of Unixfs API.
...
...
@@ -87,6 +92,19 @@ type UnixfsAPI interface {
Ls
(
context
.
Context
,
Path
)
([]
*
Link
,
error
)
}
type
BlockAPI
interface
{
Put
(
context
.
Context
,
io
.
Reader
)
(
Path
,
error
)
WithCodec
(
codec
uint64
)
options
.
BlockPutOption
WithHash
(
mhType
uint64
,
mhLen
int
)
options
.
BlockPutOption
Get
(
context
.
Context
)
(
io
.
Reader
,
error
)
Rm
(
context
.
Context
)
error
WithForce
(
force
bool
)
options
.
BlockRmOption
Stat
(
context
.
Context
)
(
BlockStat
,
error
)
}
// DagAPI specifies the interface to IPLD
type
DagAPI
interface
{
// Put inserts data using specified format and input encoding.
...
...
core/coreapi/interface/options/block.go
0 → 100644
View file @
219eae76
package
options
type
BlockPutSettings
struct
{
Codec
uint64
MhType
uint64
MhLength
int
}
type
BlockRmSettings
struct
{
Force
bool
}
type
BlockPutOption
func
(
*
BlockPutSettings
)
error
type
BlockRmOption
func
(
*
BlockRmSettings
)
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