Commit 3cd2995b authored by Łukasz Magiera's avatar Łukasz Magiera

coreapi: draft block API

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent 9704d78e
......@@ -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.
......
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
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