Queries with start > last item would return one item, because there's
some boundary condition in binary_search().
This is here fixed by always applying filters that omit items outside
the requested range.
See also 2374c7665d0b
This method would previously never delete the first (and only) item
since it works out which item should become the first item after the
trim operation, which doesn't make sense when all should be removed.
This also works as an optimization for when all the last item should be
trimmed, thus items should be removed.
Many of these fall into a few categories:
- util.cache size, must be >= 1
- byte or item counts that logically can't be negative
- port numbers that should be in 1..0xffff
Using the new shift function in datamanager, either the oldest items are
removed or all the later items are moved into a new file that replaces
the old.
Hidden behind a feature flag for now.
Iterating over an entire archive to find a few items in the far end from
where iteration started is expensive, and probably more expensive with
the lazy-loading of items added in the previous commit.
Since we can now efficiently read items in random order, we can now use
a binary search to find a better starting point for iteration.
Very large list files previously ran into limits of the Lua parser, or
just caused Prosody to freeze while parsing.
Using the new index we can parse individual items one at a time. This
probably won't reduce overall CPU usage, probably the opposite, but it
will reduce the number of items in memory at once and allow collection
of items after we iterated past them.
Should no longer be used by anything since the conversion of mod_offline
to the archive API in 0.10.0, which was 4 years ago. The line clearing
the property is left for a bit longer in case someone has very old
offline messages or archived data.
A protocol built on this API now allows showing a list of unread
conversations with a counter, ordered by either oldest or newest
message, along with the text body itself.
Clients may want to show a list of conversations ordered by how
timestamp of most recent message.
The counts allow a badge with unread message counter.