I would like to store a large amount of sorted integers, they should be traversable with efficient get
and insert
.
If I can iterate over a storage map, could you let me know how?
Or is there a BTreeMap storage type?
I would like to store a large amount of sorted integers, they should be traversable with efficient get
and insert
.
If I can iterate over a storage map, could you let me know how?
Or is there a BTreeMap storage type?
There is no sorted storage type. That would be way too expensive to realize, just imagine adding an item how many storage reads that would need. However, for small things you can just use a storage value that uses a BTreeMap
as type. Here you just need to be aware that every time you access it, you would need to decode the entire BTreeMap
. In the end it boils down to what you want to achieve and what are your constraints.