coreapi: update block after update
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
Łukasz Magiera committed
Jan 31, 2018 at 00:34 UTC
e77b93816104605adf0bf4830fa6922cac261e10
4 files changed
+11
-8
core/coreapi/block.go
+5
-5
@@ -12,9 +12,9 @@ import (
12
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
13
caopts "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
14
15
- mh "gx/ipfs/QmYeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd/go-multihash"
16
- blocks "gx/ipfs/QmYsEQydGrsxNZfAiskvQ76N2xE9hDQtSAkRSynwMiUK3c/go-block-format"
17
- cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid"
15
+ mh "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash"
16
+ cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
17
+ blocks "gx/ipfs/Qmej7nf81hi2x2tvjRBF3mcp74sQyuDH4VMYDGd1YtXjb2/go-block-format"
18
)
19
20
type BlockAPI struct {
@@ -63,12 +63,12 @@ func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Bloc
63
return nil, err
64
}
65
66
- k, err := api.node.Blocks.AddBlock(b)
66
+ err = api.node.Blocks.AddBlock(b)
67
if err != nil {
68
return nil, err
69
}
70
71
- return ParseCid(k), nil
71
+ return ParseCid(b.Cid()), nil
72
}
73
74
func (api *BlockAPI) Get(ctx context.Context, p coreiface.Path) (io.Reader, error) {
core/coreapi/block_test.go
+1
-1
@@ -6,7 +6,7 @@ import (
6
"strings"
7
"testing"
8
9
- mh "gx/ipfs/QmYeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd/go-multihash"
9
+ mh "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash"
10
)
11
12
func TestBlockPut(t *testing.T) {
core/coreapi/interface/interface.go
+4
@@ -62,12 +62,16 @@ type BlockStat interface {
62
type CoreAPI interface {
63
// Unixfs returns an implementation of Unixfs API.
64
Unixfs() UnixfsAPI
65
+
66
// Block returns an implementation of Block API.
67
Block() BlockAPI
68
+
69
// Dag returns an implementation of Dag API.
70
Dag() DagAPI
71
+
72
// Name returns an implementation of Name API.
73
Name() NameAPI
74
+
75
// Key returns an implementation of Key API.
76
Key() KeyAPI
77
core/coreapi/interface/options/block.go
+1
-2
@@ -1,8 +1,7 @@
1
package options
2
3
import (
4
- //cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid"
5
- "gx/ipfs/QmYeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd/go-multihash"
4
+ "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash"
5
)
6
7
type BlockPutSettings struct {