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: u64Transaction 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
impl JournalTxBegin
Sourcepub fn from_io(
io: &JournalIO<'_>,
lba: LogicalBlockAddress,
) -> Result<Box<Self>, KernelError>
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.
Sourcepub fn into_block(self: Box<Self>) -> Box<[u8; 4096]>
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.