Skip to main content

Wal

Struct Wal 

Source
pub struct Wal { /* private fields */ }
Expand description

File-backed active-session WAL.

Implementations§

Source§

impl Wal

Source

pub fn new(path: impl Into<PathBuf>) -> Self

Create a WAL handle for a path.

Source

pub fn for_layout(layout: &RepositoryLayout) -> Self

Create a WAL handle authorized by a validated repository layout.

Source

pub fn path(&self) -> &Path

Return the WAL path.

Source

pub fn append_patch(&self, envelope: &ObjectEnvelope) -> Result<u64>

Append a signed patch envelope and fsync the WAL file.

Source

pub fn replay(&self) -> Result<WalReplay>

Replay valid WAL records from the beginning.

Source

pub fn truncate_trailing_partial(&self) -> Result<WalRepair>

Safely truncate an incomplete trailing WAL record, if one exists.

This repairs only the case that FDD-02 defines as safe: valid records followed by an incomplete final record. RFC 102 Stage 2: a mid-stream checksum mismatch in a complete record no longer makes decode_records return Err – it is now an item finding (WalReplay::has_item_failure), which this function refuses on explicitly below rather than silently truncating around. The only production caller (doctor.rs’s repair_repository) already refuses earlier via doctor_repository’s own item-outcome reporting; this check is defense in depth for this function’s own contract, not the only thing enforcing it.

Source

pub fn truncate_empty(&self) -> Result<()>

Truncate the WAL after a successful publication that made all entries durable elsewhere.

Source

pub fn next_sequence(&self) -> Result<u64>

Return the next sequence number for append.

Trait Implementations§

Source§

impl Clone for Wal

Source§

fn clone(&self) -> Wal

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Wal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Wal

§

impl RefUnwindSafe for Wal

§

impl Send for Wal

§

impl Sync for Wal

§

impl Unpin for Wal

§

impl UnsafeUnpin for Wal

§

impl UnwindSafe for Wal

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.