Writer

Struct Writer 

Source
pub struct Writer {
Show 13 fields pub header_page_id: PageID, pub tsn: Tsn, pub next_page_id: PageID, pub free_lists_tree_root_id: PageID, pub events_tree_root_id: PageID, pub tags_tree_root_id: PageID, pub next_position: Position, pub reusable_page_ids: VecDeque<(PageID, Tsn)>, pub freed_page_ids: VecDeque<PageID>, pub deserialized: HashMap<PageID, Page>, pub dirty: HashMap<PageID, Page>, pub reused_page_ids: VecDeque<(PageID, Tsn)>, pub verbose: bool,
}

Fields§

§header_page_id: PageID§tsn: Tsn§next_page_id: PageID§free_lists_tree_root_id: PageID§events_tree_root_id: PageID§tags_tree_root_id: PageID§next_position: Position§reusable_page_ids: VecDeque<(PageID, Tsn)>§freed_page_ids: VecDeque<PageID>§deserialized: HashMap<PageID, Page>§dirty: HashMap<PageID, Page>§reused_page_ids: VecDeque<(PageID, Tsn)>§verbose: bool

Implementations§

Source§

impl Writer

Source

pub fn new( header_page_id: PageID, tsn: Tsn, next_page_id: PageID, free_lists_tree_root_id: PageID, events_tree_root_id: PageID, tags_tree_root_id: PageID, next_position: Position, verbose: bool, ) -> Self

Source

pub fn issue_position(&mut self) -> Position

Returns the current issue position and increments the next position.

Returns:

The current issue position.

Source

pub fn get_page_ref(&mut self, mvcc: &Mvcc, page_id: PageID) -> DCBResult<&Page>

Retrieves a reference to the page with the given ID.

First checks the dirty pages map, then the deserialized pages map. If the page is not found in either map, it is deserialized from the MVCC.

§Arguments
  • mvcc: A reference to the MVCC.
  • page_id: The ID of the page to retrieve.
§Returns

A DCBResult containing a reference to the page if found, or an error if the page could not be found.

Source

pub fn get_mut_dirty(&mut self, page_id: PageID) -> DCBResult<&mut Page>

Source

pub fn insert_deserialized(&mut self, page: Page)

Source

pub fn insert_dirty(&mut self, page: Page) -> DCBResult<()>

Source

pub fn alloc_page_id(&mut self) -> PageID

Source

pub fn get_dirty_page_id(&mut self, page_id: PageID) -> DCBResult<PageID>

Source

pub fn append_freed_page_id(&mut self, page_id: PageID)

Source

pub fn find_reusable_page_ids(&mut self, mvcc: &Mvcc) -> DCBResult<()>

Source

pub fn insert_freed_page_id( &mut self, mvcc: &Mvcc, tsn: Tsn, freed_page_id: PageID, ) -> DCBResult<()>

Source

pub fn remove_free_page_id( &mut self, mvcc: &Mvcc, tsn: Tsn, used_page_id: PageID, ) -> DCBResult<()>

Auto Trait Implementations§

§

impl Freeze for Writer

§

impl RefUnwindSafe for Writer

§

impl Send for Writer

§

impl Sync for Writer

§

impl Unpin for Writer

§

impl UnwindSafe for Writer

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.