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']
Parameters
range : KvStore.KeyRange | None

If specified, restricts to the specified key range.

strip_prefix_length : int

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.