Merge pull request #2534 from filecoin-project/asr/getsize

Implement buffered blocktore GetSize()
This commit is contained in:
Łukasz Magiera 2020-07-23 10:59:28 +02:00 committed by GitHub
commit 22c684deb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,12 @@ func (bs *BufferedBS) Get(c cid.Cid) (block.Block, error) {
}
func (bs *BufferedBS) GetSize(c cid.Cid) (int, error) {
panic("nyi")
s, err := bs.read.GetSize(c)
if err == bstore.ErrNotFound || s == 0 {
return bs.write.GetSize(c)
}
return s, err
}
func (bs *BufferedBS) Put(blk block.Block) error {