From 708492cb9ec7a097bbb38762232f0b9605c5baf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 31 Jan 2018 00:34:51 +0100 Subject: [PATCH] coreapi: update block after update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Ɓukasz Magiera --- core/coreapi/block.go | 10 +++++----- core/coreapi/block_test.go | 2 +- core/coreapi/interface/interface.go | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/coreapi/block.go b/core/coreapi/block.go index 561389f074f..ffb619597d3 100644 --- a/core/coreapi/block.go +++ b/core/coreapi/block.go @@ -12,9 +12,9 @@ import ( coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" caopts "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - mh "gx/ipfs/QmYeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd/go-multihash" - blocks "gx/ipfs/QmYsEQydGrsxNZfAiskvQ76N2xE9hDQtSAkRSynwMiUK3c/go-block-format" - cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid" + mh "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash" + cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" + blocks "gx/ipfs/Qmej7nf81hi2x2tvjRBF3mcp74sQyuDH4VMYDGd1YtXjb2/go-block-format" ) type BlockAPI struct { @@ -63,12 +63,12 @@ func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Bloc return nil, err } - k, err := api.node.Blocks.AddBlock(b) + err = api.node.Blocks.AddBlock(b) if err != nil { 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) { diff --git a/core/coreapi/block_test.go b/core/coreapi/block_test.go index bef532fdc4a..7fcdbca7ea8 100644 --- a/core/coreapi/block_test.go +++ b/core/coreapi/block_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - mh "gx/ipfs/QmYeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd/go-multihash" + mh "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash" ) func TestBlockPut(t *testing.T) { diff --git a/core/coreapi/interface/interface.go b/core/coreapi/interface/interface.go index 2402ecf8138..95351e7d045 100644 --- a/core/coreapi/interface/interface.go +++ b/core/coreapi/interface/interface.go @@ -62,12 +62,16 @@ type BlockStat interface { type CoreAPI interface { // Unixfs returns an implementation of Unixfs API. Unixfs() UnixfsAPI + // Block returns an implementation of Block API. Block() BlockAPI + // Dag returns an implementation of Dag API. Dag() DagAPI + // Name returns an implementation of Name API. Name() NameAPI + // Key returns an implementation of Key API. Key() KeyAPI