Module yaque::recovery [−][src]
Recovery utilities for queues left in as inconsistent state, based on “best effort” strategies. Use these functions if you need to automatically recover from a failure.
We offer two different approaches to queue recovery, which may be suitable to different use cases:
- Recover with replay (the standard): we can reconstruct a lower bound
of the actual state of the queue during the crash, which consists of the
maximum of the following two positions:
- the bottom of the smallest segment still present in the directory.
- the position indicated in the metadata file.
Since this is a lower bound, some elements may be replayed. If your processing is idempotent, this will not be an issue and you lose no data whatsoever.
- Recover with loss: we can also reconstruct an upper bound for the
actual state of the queue: the bottom of the second smallest segment in
the queue. In this case, the smallest segment is simply erased and the
receiver caries on as if nothing has happened. If replays are intollerable,
but some data loss is, this might be the right alternative for you. You can
limit data loss by constraining the segment size, configuring this option on
crate::SenderBuilder
.
Functions
guess_recv_metadata | Guesses the receive metadata for a given queue, using the “with replay” strategy. This equals to the bottom position in the smallest segment present in the directory or the existing receiver metadata, whichever is greater. The reason for this is that the receive metadata is a lower bound of where the receiver actually was and this guess is always lower than that. |
guess_recv_metadata_with_loss | Guesses the receive metadata for a given queue, using the “with loss” strategy. This equals to the bottom position in the segment after the smallest one present in the directory. This function will substitute the current receive metadata by this guess upon acquiring the receive lock on this queue. |
recover | Recovers a queue using the “with replay” strategy. |
recover_with_loss | Recovers a queue using the “with loss” strategy. |
unlock | Unlocks a |
unlock_for_receiving | Unlocks a queue in a given directory for receiving. This function returns
an error of kind |
unlock_for_sending | Unlocks a queue in a given directory for sending. This function returns an
error of kind |
unlock_queue | Unlocks a queue in a given directory for both sending and receiving. This
function is the combination of |