From 8601e5da3ad5c07985e46ab471a31425b34c6bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Sun, 28 Feb 2021 19:44:02 +0000 Subject: [PATCH] address review comments. --- api/api_common.go | 5 ----- api/api_full.go | 6 ++++++ blockstore/blockstore.go | 3 +++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/api/api_common.go b/api/api_common.go index 910c25143..f8f20fd37 100644 --- a/api/api_common.go +++ b/api/api_common.go @@ -16,11 +16,6 @@ import ( "github.com/filecoin-project/lotus/build" ) -type ChainIO interface { - ChainReadObj(context.Context, cid.Cid) ([]byte, error) - ChainHasObj(context.Context, cid.Cid) (bool, error) -} - type Common interface { // MethodGroup: Auth diff --git a/api/api_full.go b/api/api_full.go index 12b3ecf63..294fb3c1c 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -32,6 +32,12 @@ import ( "github.com/filecoin-project/lotus/node/modules/dtypes" ) +// ChainIO abstracts operations for accessing raw IPLD objects. +type ChainIO interface { + ChainReadObj(context.Context, cid.Cid) ([]byte, error) + ChainHasObj(context.Context, cid.Cid) (bool, error) +} + // FullNode API is a low-level interface to the Filecoin network full node type FullNode interface { Common diff --git a/blockstore/blockstore.go b/blockstore/blockstore.go index a69d31fe0..5d4578777 100644 --- a/blockstore/blockstore.go +++ b/blockstore/blockstore.go @@ -59,5 +59,8 @@ func (a *adaptedBlockstore) View(cid cid.Cid, callback func([]byte) error) error // View proxies over to Get and calls the callback with the value supplied by Get. // Sync noops. func Adapt(bs blockstore.Blockstore) Blockstore { + if ret, ok := bs.(Blockstore); ok { + return ret + } return &adaptedBlockstore{bs} }