ipfs / go-datastore

key-value datastore interfaces
MIT License
228 stars 64 forks source link

add a GetSize method #99

Closed Stebalien closed 5 years ago

Stebalien commented 5 years ago

We can also add this as an extension but it's simple enough I'd like to add it directly to the Datastore.

Use-case: The blockstore now has a GetSize and bitswap uses it for packing multiple blocks into a single message. Unfortunately, this means that bitswap is now calling blockstore.GetSize which calls datastore.Get which tends to be more expensive than datastore.Has.

Sub-PRs: