JournalTxBegin

Struct JournalTxBegin 

Source
pub struct JournalTxBegin {
    pub tx_id: u64,
    pub lbas: [Option<LogicalBlockAddress>; 511],
}
Expand description

Represents a journal transaction header used to track modified blocks.

This structure is used during transaction commit to list all blocks that are affected by the transaction.

Fields§

§tx_id: u64

Transaction id.

§lbas: [Option<LogicalBlockAddress>; 511]

Array of logical block addresses involved in the transaction.

  • Some(lba): a block to be committed.
  • None: an unused slot.

Implementations§

Source§

impl JournalTxBegin

Source

pub fn new(tx_id: u64) -> Box<Self>

Creates a new, empty journal TxBegin block.

Source

pub fn from_io( io: &JournalIO<'_>, lba: LogicalBlockAddress, ) -> Result<Box<Self>, KernelError>

Loads a journal TxBegin block from disk at the specified LBA.

§Arguments
  • io: Interface for reading blocks from disk.
  • lba: Logical block address of the journal transaction block to load.
§Returns
  • Ok(Box<Self>): The loaded journal transaction block.
  • Err(KernelError): If the block could not be read or parsed.
Source

pub fn into_block(self: Box<Self>) -> Box<[u8; 4096]>

Converts this transaction into a 4096-byte block suitable for writing to disk.

This is typically used during transaction commit.

Auto Trait Implementations§

§

impl Freeze for JournalTxBegin

§

impl RefUnwindSafe for JournalTxBegin

§

impl Send for JournalTxBegin

§

impl Sync for JournalTxBegin

§

impl Unpin for JournalTxBegin

§

impl UnwindSafe for JournalTxBegin

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.