mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 10:49:24 +08:00
coreapi: update block after update
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
@ -12,9 +12,9 @@ import (
|
|||||||
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
|
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
|
||||||
caopts "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
|
caopts "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
|
||||||
|
|
||||||
mh "gx/ipfs/QmYeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd/go-multihash"
|
mh "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash"
|
||||||
blocks "gx/ipfs/QmYsEQydGrsxNZfAiskvQ76N2xE9hDQtSAkRSynwMiUK3c/go-block-format"
|
cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
|
||||||
cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid"
|
blocks "gx/ipfs/Qmej7nf81hi2x2tvjRBF3mcp74sQyuDH4VMYDGd1YtXjb2/go-block-format"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BlockAPI struct {
|
type BlockAPI struct {
|
||||||
@ -63,12 +63,12 @@ func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Bloc
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
k, err := api.node.Blocks.AddBlock(b)
|
err = api.node.Blocks.AddBlock(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ParseCid(k), nil
|
return ParseCid(b.Cid()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *BlockAPI) Get(ctx context.Context, p coreiface.Path) (io.Reader, error) {
|
func (api *BlockAPI) Get(ctx context.Context, p coreiface.Path) (io.Reader, error) {
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
mh "gx/ipfs/QmYeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd/go-multihash"
|
mh "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBlockPut(t *testing.T) {
|
func TestBlockPut(t *testing.T) {
|
||||||
|
@ -62,12 +62,16 @@ type BlockStat interface {
|
|||||||
type CoreAPI interface {
|
type CoreAPI interface {
|
||||||
// Unixfs returns an implementation of Unixfs API.
|
// Unixfs returns an implementation of Unixfs API.
|
||||||
Unixfs() UnixfsAPI
|
Unixfs() UnixfsAPI
|
||||||
|
|
||||||
// Block returns an implementation of Block API.
|
// Block returns an implementation of Block API.
|
||||||
Block() BlockAPI
|
Block() BlockAPI
|
||||||
|
|
||||||
// Dag returns an implementation of Dag API.
|
// Dag returns an implementation of Dag API.
|
||||||
Dag() DagAPI
|
Dag() DagAPI
|
||||||
|
|
||||||
// Name returns an implementation of Name API.
|
// Name returns an implementation of Name API.
|
||||||
Name() NameAPI
|
Name() NameAPI
|
||||||
|
|
||||||
// Key returns an implementation of Key API.
|
// Key returns an implementation of Key API.
|
||||||
Key() KeyAPI
|
Key() KeyAPI
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package options
|
package options
|
||||||
|
|
||||||
import (
|
import (
|
||||||
//cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid"
|
"gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash"
|
||||||
"gx/ipfs/QmYeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd/go-multihash"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type BlockPutSettings struct {
|
type BlockPutSettings struct {
|
||||||
|
Reference in New Issue
Block a user