fix TimedCacheBlockstore#View.
This commit is contained in:
parent
45a650c012
commit
853de3daf7
@ -102,12 +102,14 @@ func (t *TimedCacheBlockstore) PutMany(bs []blocks.Block) error {
|
|||||||
return t.active.PutMany(bs)
|
return t.active.PutMany(bs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TimedCacheBlockstore) View(c cid.Cid, callback func([]byte) error) error {
|
func (t *TimedCacheBlockstore) View(k cid.Cid, callback func([]byte) error) error {
|
||||||
blk, err := t.Get(c)
|
t.mu.RLock()
|
||||||
if err != nil {
|
defer t.mu.RUnlock()
|
||||||
return err
|
err := t.active.View(k, callback)
|
||||||
|
if err == ErrNotFound {
|
||||||
|
err = t.inactive.View(k, callback)
|
||||||
}
|
}
|
||||||
return callback(blk.RawData())
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TimedCacheBlockstore) Get(k cid.Cid) (blocks.Block, error) {
|
func (t *TimedCacheBlockstore) Get(k cid.Cid) (blocks.Block, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user