use crate::tx::{
TxPtrAccess,
access::{RoGuard, RwUnsync},
};
use ffi::{MDBX_TXN_RDONLY, MDBX_TXN_READWRITE, MDBX_txn_flags_t};
mod private {
pub trait Sealed {}
impl Sealed for super::RO {}
impl Sealed for super::RW {}
}
#[derive(Debug, Clone, Copy)]
#[non_exhaustive]
pub struct RO;
#[derive(Debug, Clone, Copy)]
#[non_exhaustive]
pub struct RW;
pub trait TransactionKind: private::Sealed + core::fmt::Debug + 'static {
#[doc(hidden)]
const OPEN_FLAGS: MDBX_txn_flags_t;
const IS_READ_ONLY: bool;
type Inner: TxPtrAccess;
}
impl TransactionKind for RO {
const OPEN_FLAGS: MDBX_txn_flags_t = MDBX_TXN_RDONLY;
const IS_READ_ONLY: bool = true;
type Inner = RoGuard;
}
impl TransactionKind for RW {
const OPEN_FLAGS: MDBX_txn_flags_t = MDBX_TXN_READWRITE;
const IS_READ_ONLY: bool = false;
type Inner = RwUnsync;
}