Function yaque::recovery::recover

source ·
pub fn recover<P: AsRef<Path>>(base: P) -> Result<()>
Expand description

Recovers a queue using the “with replay” strategy.

It applies the following operations, in this order:

  • Unlocks both the sender and receiver side of the queue.
  • Guesses the position of the receiver using guess_recv_metadata (this is just the existing state of the receiver most of the time).

This means that some of the data may be replayed, since the receiver metadata is rarely touched (and it is always a lower bound of where the receiver actually was). If replays are not acceptable, see recover_with_loss.

You should also use recover_with_loss if you suppose your data was corrupted.

Panics

This function panics if there is a file in the queue folder with extension .q whose name is not an integer, such as foo.q or if the lock files for either sending or receiving cannot be parsed.