-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Reference Issue: vacp2p/rfc#463
Author: D4nte
Problem
The Direction field in HistoryQuery for Waku Store allows the query to specify the direction in which results should be returned:
direction: indicates the direction of paging which can be either FORWARD or BACKWARD.
This does not affect the order of messages within a page. Messages are always order oldest first.
It seems a bit counter-intuitive to me. Indeed, if a caller uses the direction BACKWARD one could argue that they want to process the latest message first.
However, with the current design, they would need to browse the returned array from the end to process the latest message first.
Possible Solutions
A solution would be for the order of messages to be affected by the direction value.
Another solution would be to introduce a new field to request order of messages or a new field that affect both page and message order to then deprecate the current direction field.
Notes
Depending on the solution, we may need to upgrade the protocol version to ensure we do not modify the existing behaviour.