Skip to main content

TxnEnv

Struct TxnEnv 

Source
pub struct TxnEnv<F: FileBackend = FileHandle> { /* private fields */ }
Expand description

Environment shared by every WriteTxn / ReadTxn in a process. Holds the pager (behind an Arc<Mutex<_>>), the in- process write-serialization mutex, and — for file-backed databases — an optional FileHandle used for cross-process byte-range locking.

TxnEnv is Send + Sync; construct one and share via Arc across threads (or across an obj::Db whose ownership wraps it).

Implementations§

Source§

impl<F: FileBackend> TxnEnv<F>

Source

pub fn new(pager: Pager<F>, lock_file: Option<Arc<FileHandle>>) -> Self

Construct an env wrapping the given pager. lock_file is an optional dedicated file handle for cross-process locks; pass None for in-memory or fault-injection environments.

Source

pub fn pager(&self) -> &Arc<Mutex<Pager<F>>>

Shared access to the pager’s Arc<Mutex<_>>. Used by the obj::Db wrapper (M6 issue #47) to dispatch reads inside a ReadTxn closure. Exposed at the txn boundary so the M6 stress test can sample state without a full WriteTxn.

Trait Implementations§

Source§

impl<F: Debug + FileBackend> Debug for TxnEnv<F>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<F> Freeze for TxnEnv<F>

§

impl<F> RefUnwindSafe for TxnEnv<F>

§

impl<F> Send for TxnEnv<F>
where F: Send,

§

impl<F> Sync for TxnEnv<F>
where F: Send,

§

impl<F> Unpin for TxnEnv<F>

§

impl<F> UnsafeUnpin for TxnEnv<F>

§

impl<F> UnwindSafe for TxnEnv<F>

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 = 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V