mirror of
https://github.com/filecoin-project/lotus.git
synced 2026-03-13 08:32:30 +08:00
fix: adapt to removal of HashOnRead from blockstore interface
This commit is contained in:
@@ -89,5 +89,3 @@ func (a *apiBlockstore) PutMany(ctx context.Context, blocks []blocks.Block) erro
|
||||
func (a *apiBlockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
|
||||
return nil, xerrors.New("not supported")
|
||||
}
|
||||
|
||||
func (a *apiBlockstore) HashOnRead(bool) {}
|
||||
|
||||
@@ -252,10 +252,6 @@ func (bs *AutobatchBlockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid,
|
||||
return bs.backingBs.AllKeysChan(ctx)
|
||||
}
|
||||
|
||||
func (bs *AutobatchBlockstore) HashOnRead(enabled bool) {
|
||||
bs.backingBs.HashOnRead(enabled)
|
||||
}
|
||||
|
||||
func (bs *AutobatchBlockstore) View(ctx context.Context, cid cid.Cid, callback func([]byte) error) error {
|
||||
blk, err := bs.Get(ctx, cid)
|
||||
if err != nil {
|
||||
|
||||
@@ -1015,12 +1015,6 @@ func (b *Blockstore) ForEachKey(f func(cid.Cid) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// HashOnRead implements Blockstore.HashOnRead. It is not supported by this
|
||||
// blockstore.
|
||||
func (b *Blockstore) HashOnRead(_ bool) {
|
||||
log.Warnf("called HashOnRead on badger blockstore; function not supported; ignoring")
|
||||
}
|
||||
|
||||
// PooledStorageKey returns the storage key under which this CID is stored.
|
||||
//
|
||||
// The key is: prefix + base32_no_padding(cid.Hash)
|
||||
|
||||
@@ -161,11 +161,6 @@ func (bs *BufferedBlockstore) Has(ctx context.Context, c cid.Cid) (bool, error)
|
||||
return bs.read.Has(ctx, c)
|
||||
}
|
||||
|
||||
func (bs *BufferedBlockstore) HashOnRead(hor bool) {
|
||||
bs.read.HashOnRead(hor)
|
||||
bs.write.HashOnRead(hor)
|
||||
}
|
||||
|
||||
func (bs *BufferedBlockstore) PutMany(ctx context.Context, blks []block.Block) error {
|
||||
return bs.write.PutMany(ctx, blks)
|
||||
}
|
||||
|
||||
@@ -81,10 +81,6 @@ func (c *ReadCachedBlockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid,
|
||||
return c.top.AllKeysChan(ctx)
|
||||
}
|
||||
|
||||
func (c *ReadCachedBlockstore) HashOnRead(enabled bool) {
|
||||
c.top.HashOnRead(enabled)
|
||||
}
|
||||
|
||||
func (c *ReadCachedBlockstore) View(ctx context.Context, cid cid.Cid, callback func([]byte) error) error {
|
||||
return c.top.View(ctx, cid, func(bb []byte) error {
|
||||
blk, err := blocks.NewBlockWithCid(bb, cid)
|
||||
|
||||
@@ -22,10 +22,6 @@ func (b *discardstore) Has(ctx context.Context, cid cid.Cid) (bool, error) {
|
||||
return b.bs.Has(ctx, cid)
|
||||
}
|
||||
|
||||
func (b *discardstore) HashOnRead(hor bool) {
|
||||
b.bs.HashOnRead(hor)
|
||||
}
|
||||
|
||||
func (b *discardstore) Get(ctx context.Context, cid cid.Cid) (blocks.Block, error) {
|
||||
return b.bs.Get(ctx, cid)
|
||||
}
|
||||
|
||||
@@ -169,10 +169,6 @@ func (b *idstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
|
||||
return b.bs.AllKeysChan(ctx)
|
||||
}
|
||||
|
||||
func (b *idstore) HashOnRead(enabled bool) {
|
||||
b.bs.HashOnRead(enabled)
|
||||
}
|
||||
|
||||
func (b *idstore) Close() error {
|
||||
if c, ok := b.bs.(io.Closer); ok {
|
||||
return c.Close()
|
||||
|
||||
@@ -101,9 +101,3 @@ func (m MemBlockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
|
||||
close(ch)
|
||||
return ch, nil
|
||||
}
|
||||
|
||||
// HashOnRead specifies if every read block should be
|
||||
// rehashed to make sure it matches its CID.
|
||||
func (m MemBlockstore) HashOnRead(enabled bool) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@@ -405,11 +405,6 @@ func (n *NetworkStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
|
||||
return nil, xerrors.Errorf("not supported")
|
||||
}
|
||||
|
||||
func (n *NetworkStore) HashOnRead(enabled bool) {
|
||||
// todo
|
||||
return
|
||||
}
|
||||
|
||||
func (*NetworkStore) Flush(context.Context) error { return nil }
|
||||
|
||||
func (n *NetworkStore) Stop(ctx context.Context) error {
|
||||
|
||||
@@ -619,11 +619,6 @@ func (s *SplitStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
|
||||
return ch, nil
|
||||
}
|
||||
|
||||
func (s *SplitStore) HashOnRead(enabled bool) {
|
||||
s.hot.HashOnRead(enabled)
|
||||
s.cold.HashOnRead(enabled)
|
||||
}
|
||||
|
||||
func (s *SplitStore) View(ctx context.Context, cid cid.Cid, cb func([]byte) error) error {
|
||||
if isIdentiyCid(cid) {
|
||||
data, err := decodeIdentityCid(cid)
|
||||
|
||||
@@ -93,8 +93,6 @@ func (es *exposedSplitStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, e
|
||||
return es.s.AllKeysChan(ctx)
|
||||
}
|
||||
|
||||
func (es *exposedSplitStore) HashOnRead(enabled bool) {}
|
||||
|
||||
func (es *exposedSplitStore) View(ctx context.Context, c cid.Cid, f func([]byte) error) error {
|
||||
if isIdentiyCid(c) {
|
||||
data, err := decodeIdentityCid(c)
|
||||
|
||||
@@ -681,8 +681,6 @@ func (b *mockStore) Has(_ context.Context, cid cid.Cid) (bool, error) {
|
||||
return ok, nil
|
||||
}
|
||||
|
||||
func (b *mockStore) HashOnRead(hor bool) {}
|
||||
|
||||
func (b *mockStore) Get(_ context.Context, cid cid.Cid) (blocks.Block, error) {
|
||||
b.mx.Lock()
|
||||
defer b.mx.Unlock()
|
||||
|
||||
@@ -77,7 +77,3 @@ func (m *SyncBlockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error
|
||||
// this blockstore implementation doesn't do any async work.
|
||||
return m.bs.AllKeysChan(ctx)
|
||||
}
|
||||
|
||||
func (m *SyncBlockstore) HashOnRead(enabled bool) {
|
||||
// noop
|
||||
}
|
||||
|
||||
@@ -165,10 +165,6 @@ func (t *TimedCacheBlockstore) Has(ctx context.Context, k cid.Cid) (bool, error)
|
||||
return t.inactive.Has(ctx, k)
|
||||
}
|
||||
|
||||
func (t *TimedCacheBlockstore) HashOnRead(_ bool) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
func (t *TimedCacheBlockstore) DeleteBlock(ctx context.Context, k cid.Cid) error {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
|
||||
@@ -120,9 +120,3 @@ func (m unionBlockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error
|
||||
|
||||
return outCh, nil
|
||||
}
|
||||
|
||||
func (m unionBlockstore) HashOnRead(enabled bool) {
|
||||
for _, bs := range m {
|
||||
bs.HashOnRead(enabled)
|
||||
}
|
||||
}
|
||||
|
||||
2
go.mod
2
go.mod
@@ -95,7 +95,7 @@ require (
|
||||
github.com/ipfs/go-fs-lock v0.1.1
|
||||
github.com/ipfs/go-ipld-cbor v0.2.1
|
||||
github.com/ipfs/go-ipld-format v0.6.3
|
||||
github.com/ipfs/go-log/v2 v2.8.1
|
||||
github.com/ipfs/go-log/v2 v2.8.2
|
||||
github.com/ipfs/go-metrics-interface v0.3.0
|
||||
github.com/ipfs/go-metrics-prometheus v0.1.0
|
||||
github.com/ipld/go-car v0.6.2
|
||||
|
||||
4
go.sum
4
go.sum
@@ -663,8 +663,8 @@ github.com/ipfs/go-log/v2 v2.0.1/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBW
|
||||
github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw=
|
||||
github.com/ipfs/go-log/v2 v2.1.2/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM=
|
||||
github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g=
|
||||
github.com/ipfs/go-log/v2 v2.8.1 h1:Y/X36z7ASoLJaYIJAL4xITXgwf7RVeqb1+/25aq/Xk0=
|
||||
github.com/ipfs/go-log/v2 v2.8.1/go.mod h1:NyhTBcZmh2Y55eWVjOeKf8M7e4pnJYM3yDZNxQBWEEY=
|
||||
github.com/ipfs/go-log/v2 v2.8.2 h1:nVG4nNHUwwI/sTs9Bi5iE8sXFQwXs3AjkkuWhg7+Y2I=
|
||||
github.com/ipfs/go-log/v2 v2.8.2/go.mod h1:UhIYAwMV7Nb4ZmihUxfIRM2Istw/y9cAk3xaK+4Zs2c=
|
||||
github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk=
|
||||
github.com/ipfs/go-merkledag v0.2.4/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk=
|
||||
github.com/ipfs/go-merkledag v0.11.0 h1:DgzwK5hprESOzS4O1t/wi6JDpyVQdvm9Bs59N/jqfBY=
|
||||
|
||||
Reference in New Issue
Block a user