Skip to main content

WalSource

Struct WalSource 

Source
pub struct WalSource<S: Source, W: Source> { /* private fields */ }
Expand description

A database file with its log read on top of it.

This is a Source, not a special case inside the reader: a page that the log holds a committed version of is served from there, everything else from the main file, and nothing above this line has to know that a log exists at all. The reader that walks b-trees is the same code either way.

Reads are split at page boundaries before being served, so a caller that asks for a range spanning two pages gets each half from wherever that page currently lives.

Implementations§

Source§

impl<S: Source, W: Source> WalSource<S, W>

Source

pub fn new(main: S, log: Option<W>) -> Result<WalSource<S, W>>

Put log on top of main. Pass None when there is no log file, which is the state sqlite leaves behind after a checkpoint.

Source

pub fn has_log(&self) -> bool

Whether any page is actually being served from the log.

Trait Implementations§

Source§

impl<S: Source, W: Source> Source for WalSource<S, W>

Source§

fn accounts_for_wal(&self) -> bool

This source reads the log, so a wal mode database read through it is complete by construction.

Source§

fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<()>

Read exactly buf.len() bytes at offset. Reading past the end is an error; short reads are never returned.
Source§

fn len(&self) -> Result<u64>

Size in bytes.
Source§

fn is_empty(&self) -> Result<bool>

Auto Trait Implementations§

§

impl<S, W> Freeze for WalSource<S, W>
where S: Freeze, Option<Wal<W>>: Freeze,

§

impl<S, W> RefUnwindSafe for WalSource<S, W>

§

impl<S, W> Send for WalSource<S, W>
where S: Send, Option<Wal<W>>: Send,

§

impl<S, W> Sync for WalSource<S, W>
where S: Sync, Option<Wal<W>>: Sync,

§

impl<S, W> Unpin for WalSource<S, W>
where S: Unpin, Option<Wal<W>>: Unpin,

§

impl<S, W> UnsafeUnpin for WalSource<S, W>

§

impl<S, W> UnwindSafe for WalSource<S, W>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.