tensorstore.KvStore.list(self, range: KvStore.KeyRange | None = None, strip_prefix_length: int = 0) Future[list[bytes]]

Lists the keys in the key-value store.

Example

>>> store = ts.KvStore.open({'driver': 'memory'}).result()
>>> store[b'a'] = b'value'
>>> store[b'b'] = b'value'
>>> store.list().result()
[b'a', b'b']
>>> store.list(ts.KvStore.KeyRange(inclusive_min=b'b')).result()
[b'b']
Parameters:
range: KvStore.KeyRange | None = None

If specified, restricts to the specified key range.

strip_prefix_length: int = 0

Strips the specified number of bytes from the start of the returned keys.

Returns:

Future that resolves to the list of matching keys, in an unspecified order.

Raises:

ValueError – If a transaction is specified.

Warning

This returns all keys within range as a single list. If there are a large number of matching keys, this can consume a large amount of memory.