From 7be7a9b5e32f36975e8e76748e94d40ac5048d05 Mon Sep 17 00:00:00 2001 From: Peter Rabbitson Date: Sun, 1 Nov 2020 21:58:01 +0100 Subject: [PATCH] Stop referring to github.com/ipfs/go-ipfs-blockstore outside of lib --- documentation/en/architecture/architecture.md | 2 +- lib/blockstore/memstore.go | 7 +++---- node/repo/fsrepo.go | 2 +- node/repo/interface.go | 2 +- node/repo/retrievalstoremgr/retrievalstoremgr_test.go | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/documentation/en/architecture/architecture.md b/documentation/en/architecture/architecture.md index 61cd117bb..5a9eee3c2 100644 --- a/documentation/en/architecture/architecture.md +++ b/documentation/en/architecture/architecture.md @@ -311,7 +311,7 @@ FIXME: Maybe mention the `Batching` interface as the developer will stumble upon FIXME: IPFS blocks vs Filecoin blocks ideally happens before this / here -The [`Blockstore` interface](`github.com/ipfs/go-ipfs-blockstore/blockstore.go`) structures the key-value pair +The [`Blockstore` interface](`github.com/filecoin-project/lotus/lib/blockstore.go`) structures the key-value pair into the CID format for the key and the [`Block` interface](`github.com/ipfs/go-block-format/blocks.go`) for the value. The `Block` value is just a raw string of bytes addressed by its hash, which is included in the CID key. diff --git a/lib/blockstore/memstore.go b/lib/blockstore/memstore.go index ac56cf3e6..5cfaf40a9 100644 --- a/lib/blockstore/memstore.go +++ b/lib/blockstore/memstore.go @@ -5,7 +5,6 @@ import ( blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" - blockstore "github.com/ipfs/go-ipfs-blockstore" ) // MemStore is a terminal blockstore that keeps blocks in memory. @@ -24,7 +23,7 @@ func (m MemStore) Has(k cid.Cid) (bool, error) { func (m MemStore) View(k cid.Cid, callback func([]byte) error) error { b, ok := m[k] if !ok { - return blockstore.ErrNotFound + return ErrNotFound } return callback(b.RawData()) } @@ -32,7 +31,7 @@ func (m MemStore) View(k cid.Cid, callback func([]byte) error) error { func (m MemStore) Get(k cid.Cid) (blocks.Block, error) { b, ok := m[k] if !ok { - return nil, blockstore.ErrNotFound + return nil, ErrNotFound } return b, nil } @@ -41,7 +40,7 @@ func (m MemStore) Get(k cid.Cid) (blocks.Block, error) { func (m MemStore) GetSize(k cid.Cid) (int, error) { b, ok := m[k] if !ok { - return 0, blockstore.ErrNotFound + return 0, ErrNotFound } return len(b.RawData()), nil } diff --git a/node/repo/fsrepo.go b/node/repo/fsrepo.go index d652c1e54..9bf2d5d4c 100644 --- a/node/repo/fsrepo.go +++ b/node/repo/fsrepo.go @@ -12,9 +12,9 @@ import ( "sync" "github.com/BurntSushi/toml" + "github.com/filecoin-project/lotus/lib/blockstore" "github.com/ipfs/go-datastore" fslock "github.com/ipfs/go-fs-lock" - blockstore "github.com/ipfs/go-ipfs-blockstore" logging "github.com/ipfs/go-log/v2" "github.com/mitchellh/go-homedir" "github.com/multiformats/go-base32" diff --git a/node/repo/interface.go b/node/repo/interface.go index 12f981f01..4ae68f880 100644 --- a/node/repo/interface.go +++ b/node/repo/interface.go @@ -3,8 +3,8 @@ package repo import ( "errors" + "github.com/filecoin-project/lotus/lib/blockstore" "github.com/ipfs/go-datastore" - blockstore "github.com/ipfs/go-ipfs-blockstore" "github.com/multiformats/go-multiaddr" "github.com/filecoin-project/lotus/extern/sector-storage/fsutil" diff --git a/node/repo/retrievalstoremgr/retrievalstoremgr_test.go b/node/repo/retrievalstoremgr/retrievalstoremgr_test.go index 044a8cc27..a848f62e2 100644 --- a/node/repo/retrievalstoremgr/retrievalstoremgr_test.go +++ b/node/repo/retrievalstoremgr/retrievalstoremgr_test.go @@ -9,13 +9,13 @@ import ( "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/query" dss "github.com/ipfs/go-datastore/sync" - blockstore "github.com/ipfs/go-ipfs-blockstore" format "github.com/ipfs/go-ipld-format" dag "github.com/ipfs/go-merkledag" "github.com/stretchr/testify/require" "github.com/filecoin-project/go-multistore" + "github.com/filecoin-project/lotus/lib/blockstore" "github.com/filecoin-project/lotus/node/repo/importmgr" "github.com/filecoin-project/lotus/node/repo/retrievalstoremgr" )