Transaction

Struct Transaction 

Source
pub struct Transaction {
    pub id: u32,
    pub tx_type: TransactionType,
    pub status: TransactionStatus,
    pub isolation_level: IsolationLevel,
    pub start_time: u64,
    pub depth: u8,
    /* private fields */
}
Expand description

事务上下文

Fields§

§id: u32

事务ID

§tx_type: TransactionType

事务类型

§status: TransactionStatus

事务状态

§isolation_level: IsolationLevel

事务隔离级别

§start_time: u64

开始时间戳(微秒)

§depth: u8

嵌套深度(不支持嵌套事务,固定为1)

Implementations§

Source§

impl Transaction

Source

pub unsafe fn add_log_item( &mut self, op_type: LogOperation, table_id: u8, record_id: u16, old_data: *const u8, new_data: *const u8, data_size: usize, ) -> Result<()>

添加日志项

Source

pub fn duration_us(&self) -> u64

获取事务持续时间(微秒)

Source

pub fn log_item_count(&self) -> usize

获取日志项数量

Source

pub fn is_read_only(&self) -> bool

检查事务是否只读

Source

pub fn is_active(&self) -> bool

检查事务是否活跃

Auto Trait Implementations§

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.