Trait OpenWithRepair

Source
pub trait OpenWithRepair {
    type Output;

    // Required method
    fn open_with_repair(&self, path: impl AsRef<Path>) -> Result<Self::Output>
       where Self: Sized;
}
Expand description

Repair on open.

Required Associated Types§

Required Methods§

Source

fn open_with_repair(&self, path: impl AsRef<Path>) -> Result<Self::Output>
where Self: Sized,

Call open. If it fails with data corruption errors, try repair once, then open again.

This conveniently fixes a subset of corruptions usually caused by OS crash or hard reboots. It does not fix corruptions that may occur during data reading after open.

For performance reasons, this does not perform a full verification of all data and corruption can still happen when reading data.

Repair is skipped if there are other readers for safety. This is because indexedlog requires append-only for lock-free reads. Repair is not append-only. It can silently cause other running processes reading the data, or keeping the data previously read to get silently wrong data without detection.

Implementors§

Source§

impl<T> OpenWithRepair for T
where T: OpenOptionsOutput + OpenOptionsRepair,

Source§

type Output = <T as OpenOptionsOutput>::Output