Trait tc_transact::fs::File

source ·
pub trait File: Store + Clone + 'static {
    type Key;
    type Block: BlockData;
    type Read: FileRead<File = Self> + Clone;
    type ReadExclusive: FileReadExclusive<File = Self>;
    type Write: FileWrite<File = Self>;
    type BlockRead: BlockRead<Self::Block>;
    type BlockReadExclusive: BlockReadExclusive<File = Self>;
    type BlockWrite: BlockWrite<File = Self>;
    type Inner;

    fn read<'life0, 'async_trait>(
        &'life0 self,
        txn_id: TxnId
    ) -> Pin<Box<dyn Future<Output = TCResult<Self::Read>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn try_read(&self, txn_id: TxnId) -> TCResult<Self::Read>; fn read_exclusive<'life0, 'async_trait>(
        &'life0 self,
        txn_id: TxnId
    ) -> Pin<Box<dyn Future<Output = TCResult<Self::ReadExclusive>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn try_read_exclusive<'life0, 'async_trait>(
        &'life0 self,
        txn_id: TxnId
    ) -> Pin<Box<dyn Future<Output = TCResult<Self::ReadExclusive>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn write<'life0, 'async_trait>(
        &'life0 self,
        txn_id: TxnId
    ) -> Pin<Box<dyn Future<Output = TCResult<Self::Write>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn try_write(&self, txn_id: TxnId) -> TCResult<Self::Write>; fn into_inner(self) -> Self::Inner; fn read_block<'life0, 'async_trait, Q>(
        &'life0 self,
        txn_id: TxnId,
        name: Q
    ) -> Pin<Box<dyn Future<Output = TCResult<Self::BlockRead>> + Send + 'async_trait>>
    where
        Q: Borrow<Self::Key> + Send + Sync + 'async_trait,
        Self: Sync + 'async_trait,
        'life0: 'async_trait
, { ... } fn try_read_block<'life0, 'async_trait, Q>(
        &'life0 self,
        txn_id: TxnId,
        name: Q
    ) -> Pin<Box<dyn Future<Output = TCResult<Self::BlockRead>> + Send + 'async_trait>>
    where
        Q: Borrow<Self::Key> + Send + Sync + 'async_trait,
        Self: Sync + 'async_trait,
        'life0: 'async_trait
, { ... } fn write_block<'life0, 'async_trait, I>(
        &'life0 self,
        txn_id: TxnId,
        name: I
    ) -> Pin<Box<dyn Future<Output = TCResult<Self::BlockWrite>> + Send + 'async_trait>>
    where
        I: Borrow<Self::Key> + Send + Sync + 'async_trait,
        Self: Sync + 'async_trait,
        'life0: 'async_trait
, { ... } fn try_write_block<I>(
        &self,
        txn_id: TxnId,
        name: I
    ) -> TCResult<Self::BlockWrite>
    where
        I: Borrow<Self::Key> + Send + Sync
, { ... } }
Expand description

A transactional file

Required Associated Types§

The type used to identify blocks in this File

The type used to identify blocks in this File

The type of read guard used by this File

The type of exclusive read guard used by this File

The type of write guard used by this File

A read lock on a block in this file

An exclusive read lock on a block in this file

A write lock on a block in this file

The underlying filesystem directory which contains this File’s blocks

Required Methods§

Lock the contents of this file for reading at the given txn_id.

Lock the contents of this file for reading at the given txn_id synchronously, if possible.

Lock the contents of this file for reading at the given txn_id, exclusively, i.e. don’t allow any more read locks while this one is active.

Lock the contents of this file for reading at the given txn_id, exclusively, synchronously if possible.

Lock the contents of this file for writing.

Lock the contents of this file for writing, synchronously if possible.

Provided Methods§

Convenience method to lock the block at name for reading.

Convenience method to lock the block at name for reading synchronously if possible.

Convenience method to lock the block at name for writing.

Convenience method to lock the block at name for writing synchronously, if possible.

Implementors§