Implement buffered blocktore GetSize()

This commit is contained in:
Aayush Rajasekaran 2020-07-22 15:26:57 -04:00
parent 9b1d2f4c13
commit 54c0ae17f4

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 0, err
}
func (bs *BufferedBS) Put(blk block.Block) error {