So, I have different u64s representing timestamps. For each timestamp I want to save a BigUint.
Whenever I call a method, I want to iterate through those timestamps chronologically and stop when I get to a timestamp that is higher than the current timestamp.
For each iterated timestamp (that is smaller than the actual timestamp) I want to move the associated biguint somewhere else in memory (not relevant where to the use case, I think) and then delete that timestamp (and keep the order intact).
For now, the only reasonable way I see this happening is:
SetMapper for timestamps so they always keep their order (timestamps will be unique so it is fine)
SingleValueMapper for each timestamp that stores the biguint.
Is there any better way to do it?
The thing is that a setmapper also doesn't guarantee the original order, at least according to the comments
https://github.com/ElrondNetwork/elrond-wasm-rs/blob/master/elrond-wasm/src/storage/mappers/set_mapper.rs#L141
If you want to rely on the fact that it does, despite the fact that the comment says otherwise you could also use the MapMapper as that uses the SetMapper internally :)
(Basically a MapMapper does the same as you suggested)
The thing is that a setmapper also doesn't guarantee the original order, at least according to the comments https://github.com/ElrondNetwork/elrond-wasm-rs/blob/master/elrond-wasm/src/storage/mappers/set_mapper.rs#L141 If you want to rely on the fact that it does, despite the fact that the comment says otherwise you could also use the MapMapper as that uses the SetMapper internally :) (Basically a MapMapper does the same as you suggested)
Also assuming you only have increasing timestamps, wouldn't a simple QueueMapper suffice? ????