- Removed
async
fromReceiver::open
andchannel
. Instead of awaiting for the the segment file to be created, theReceiver
now atomically creates it if it doesn't exist.
clear
is nowtry_clear
. The methodclear
will be async and await the queue to be accessible.RecvGuard
will now rollback on drop (best effort).RecvGuard::commit
will have to be always invoked explicitly.- You now may save the state of the queue explicitly in
Sender
andReceiver
. You can use this to backup the queue from time to time, which is useful if you fear your program may abort.
- Solved a bug in
RecvGuard::into_inner
: it was rolling back instead of committing.
- Typo corrections.
- Small improvements to docs.
- Feature
recovery
: utilities for unlocking locks and to guess send metadata. Guessing recv metadata is trickier and will be "coming soon". - Performance improvements to the
Receiver
: buffer input + less lock contention. This is quite significant in terms of throughput.
- Solved a bug in
recovery::unlock
: the file was not being parsed correctly. recovery::unlock
now ignores missing files, as it should.- Exposed
FileGuard
.
- Renamed
Receiver::take_while
toReceiver::take_until
because that is what it does. Also, now the supplied closure must return a future. This allows for, e.g., timers!
Receiver::recv
is now really atomic in an async context. Therefore, if you do not poll the future to completion, no changes will be made to the receiver state.
- Small improvements to docs.
- Unit tests will perform correctly after a previous run was interrupted by CTRL+C.
- Created the
recovery::recover
function for a "full course" queue recover in a single command.
recv_timeout
andrecv_batch_timeout
to allow receiving with timeout.recv_batch
is "atomic in an asynchronous context".- Now, unlock works even if the process re-spawns with the same PID.
- Recovery of queue works with two modes: replay, which is the behavior of
recovery::recover
, and "with loss", that discards the bottom segment entirely (a bit extreme, but we will work on that). Use therecovery::recover_with_loss
for this option. - Docs improvements.
- Refactored crate structure.
- Removed sender-side metadata (the
send_metadata
file). Now, the state of the sender is always inferred as being the top of the top segment. Period. It happens that having sender-side metadata was a liability (risk of overwriting data). - Changed in-disk format! However, if you have no items greater than 67MB, you can still benefit from compatibility. From now on, items are limited to ~67MB (a bit tight, I know), but you get parity checking for an extra layer of safety. Expect future releases to be completely incompatible with present format. Compatibility is only supported within the same minor version.
- Corrected a bug on the
send_metadata
inference thingy. Now, all tests are passing.
- Changed in-disk format again. This time, things are woefully incompatible. Don't use
a
<0.5.1
queue with0.6.0
. You will fail miserably. The difference that breaks compatibility is one extra parity bit flag in the item header. Before0.6.0
, it was used to ensure "legacy mode", where no parity checking took place. Now, it is a parity bit all on itself. This leads to much more robust error detection (up to 2bits, guaranteed, but you can get lucky with more!). - Now you can control the sender more finely with
SenderBuilder
. This includes choosing a segment size that fits your needs and choosing the "maximum size" for the queue. - And yes, now you can control maximum queue size so that
yaque
doesn't blow up your hard drive. This means that some major API changes took place:Sender::send
becomesSender::try_send
and returns aTrySendError
. The same thing happens toSender::send_batch
.- A new method called
Sender::send
is created that works like good oldSender::send
, except that it is async and.await
s for the queue to shrink below the maximum size. The same thing happens toSender::send_batch
.
- You can also just try to receive items, without the need to
.await
anything. For each fo the receiving methodsrecv
,recv_batch
andrecv_until
you now have the try versions:try_recv
,try_recv_batch
,try_recv_until
. - Solved a bug regarding the rollback of batch transactions when crossing over a segment.
Older versions will do a complete mess out of this. The side effect:
commit
now returns aResult
, which has to be treated.
- Introduced a new invariant: all items have to be read and used by the end of every transaction. I could not verify if this invariant always holds. Anyway, there is an assertion in the code to avoid the worse. If you find such a situation, please fill an issue.
- Dropping the Receiver forced the
state
to be saved, not theinitial_state
(the state at the beginning of the current transaction). Now,Drop
callsReceiver::save
so that the behavior will be always consistent. - We have a backup strategy for saving the queue! It involves no async stuff, so it will only be triggered at the end of a transaction. The current criterion is: save at every 250 items read or every 350ms, whichever comes first. This should diminish greatly the necessity for external control of the save mechanism.
- Created a
ReceiverBuilder
to allow people to customize the way the queue is saved. This includes altering the above defaults or disabling queue saving altogether.
- Created a
QueueIter
which allows to iterate through a queue as a list. The interface is completely synchronous and has less overhead than just using theReceiver
, besides leading to clearer code. - Documented some undocumented items.
- Upgraded dependencies and reduced the total number of them.
- Changes to mirror the pre-releases of
notify
.
- Update dependencies and fix vulnerabilities (dependabot).
- Added
Receiver::recv_batch_up_to
andReceiver::try_recv_batch_up_to
so that you can fetch "up ton
" elements from the queue or wait until one arrives. - You can now send and receive empty messages.
- Fixed typos in the documentation.