mintlayer / mintlayer-core

Mintlayer Core: The central repository housing the essential components to operate a Mintlayer node. It encompasses the node and wallet functionalities necessary for seamless operation, alongside an additional API server designed to facilitate applications.
https://www.mintlayer.org
MIT License
42 stars 24 forks source link

Implement `greater_equal_iter` and `OrderPreservingValue` in storage #1769

Closed ImplOfAnImpl closed 3 weeks ago

ImplOfAnImpl commented 3 weeks ago

greater_equal_iter allows iterating over items with keys bigger than or equal to the specified one. OrderPreservingValue is a wrapper whose Encoded form has the same ordering as the wrapped value itself (for now it's implemented only for u16/u32/u64).

I also did some cleanup here and there. In particular, storage traits now return impl Iterator and the associated type PrefixIter has been removed.

Note: storage-backend-test-suite now has "frontend" tests (it's where I test greater_equal_iter and OrderPreservingValue together for all backend types); because of this, the crate now depends on the storage crate itself. On the other hand, I removed the dependency of storage on storage-inmemory (there was an old TODO to remove this dependency), so now storage doesn't depend on any of the db-specific storage crates.