zarr-python icon indicating copy to clipboard operation
zarr-python copied to clipboard

[v3]: Add Store method for getting the size of an item.

Open TomAugspurger opened this issue 1 year ago • 0 comments

Zarr version

v3

Numcodecs version

n/a

Python Version

n/a

Operating System

n/a

Installation

n/a

Description

In https://github.com/zarr-developers/zarr-python/pull/2400, we need a method for getting the size of some object from a Store to support .info. The cleanest way to do this is a new method in the Store API.

We could implement an inefficient version that basically does

def size(self, key: str) -> int:
    return len(await self.get(key))

Many backends will have more efficient methods for getting the size of a file / object without actually reading it.

Steps to reproduce

.

Additional output

No response

TomAugspurger avatar Oct 20 '24 16:10 TomAugspurger