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§
sourcetype ReadExclusive: FileReadExclusive<File = Self>
type ReadExclusive: FileReadExclusive<File = Self>
The type of exclusive read guard used by this File
sourcetype BlockReadExclusive: BlockReadExclusive<File = Self>
type BlockReadExclusive: BlockReadExclusive<File = Self>
An exclusive read lock on a block in this file
sourcetype BlockWrite: BlockWrite<File = Self>
type BlockWrite: BlockWrite<File = Self>
A write lock on a block in this file
Required Methods§
sourcefn 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 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,
Lock the contents of this file for reading at the given txn_id
.
sourcefn try_read(&self, txn_id: TxnId) -> TCResult<Self::Read>
fn try_read(&self, txn_id: TxnId) -> TCResult<Self::Read>
Lock the contents of this file for reading at the given txn_id
synchronously, if possible.
sourcefn 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 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,
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.
sourcefn 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 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,
Lock the contents of this file for reading at the given txn_id
, exclusively, synchronously
if possible.
sourcefn 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 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,
Lock the contents of this file for writing.
sourcefn try_write(&self, txn_id: TxnId) -> TCResult<Self::Write>
fn try_write(&self, txn_id: TxnId) -> TCResult<Self::Write>
Lock the contents of this file for writing, synchronously if possible.
fn into_inner(self) -> Self::Inner
Provided Methods§
sourcefn 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 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,
Convenience method to lock the block at name
for reading.
sourcefn 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 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,
Convenience method to lock the block at name
for reading synchronously if possible.
sourcefn 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 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,
Convenience method to lock the block at name
for writing.
sourcefn try_write_block<I>(&self, txn_id: TxnId, name: I) -> TCResult<Self::BlockWrite>where
I: Borrow<Self::Key> + Send + Sync,
fn try_write_block<I>(&self, txn_id: TxnId, name: I) -> TCResult<Self::BlockWrite>where
I: Borrow<Self::Key> + Send + Sync,
Convenience method to lock the block at name
for writing synchronously, if possible.