linera-protocol icon indicating copy to clipboard operation
linera-protocol copied to clipboard

Implement `range_get` for `*MapView` and `*CollectionView`.

Open MathieuDutSik opened this issue 1 month ago • 2 comments

The storage of RocksDb, Memory, and ScyllaDb allows accessing keys from one key to another. This would allow implementing a

async fn find_keys_by_interval(&self, prefix_len: usize, start: &[u8], end: &[u8]) -> Result<Vec<Vec<u8>>, K::Error>

That would return the keys between start and end and drop the first prefix_len keys. It is possible to implement this directly, except maybe for DynamoDb. We would, of course, also have a find_key_values_by_interval.

The start and end could be Included, Excluded, or Unbounded. Though we have to check

When done, this would allow implementing a range_get for the MapView and similar views. Depending on the container, the ordering of the keys would be different.

MathieuDutSik avatar Oct 14 '25 09:10 MathieuDutSik

Do we need this?

ma2bd avatar Nov 09 '25 18:11 ma2bd

I think it is a nice feature that we could have.

But the use case that we had in fn block_hashes has been killed by https://github.com/linera-io/linera-protocol/pull/4897

MathieuDutSik avatar Nov 11 '25 17:11 MathieuDutSik