Trait tc_transact::fs::FileRead
source · pub trait FileRead: Sized + Send + Sync {
type File: File;
fn block_ids(&self) -> BTreeSet<<Self::File as File>::Key>;
fn contains<Q>(&self, name: Q) -> bool
where
Q: Borrow<<Self::File as File>::Key>;
fn is_empty(&self) -> bool;
fn read_block<'life0, 'async_trait, Q>(
&'life0 self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockRead>> + Send + 'async_trait>>
where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
fn try_read_block<Q>(
&self,
name: Q
) -> TCResult<<Self::File as File>::BlockRead>
where
Q: Borrow<<Self::File as File>::Key> + Send + Sync;
fn read_block_exclusive<'life0, 'async_trait, Q>(
&'life0 self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockReadExclusive>> + Send + 'async_trait>>
where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
fn try_read_block_exclusive<Q>(
&self,
name: Q
) -> TCResult<<Self::File as File>::BlockReadExclusive>
where
Q: Borrow<<Self::File as File>::Key> + Send + Sync;
fn write_block<'life0, 'async_trait, Q>(
&'life0 self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockWrite>> + Send + 'async_trait>>
where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
fn try_write_block<Q>(
&self,
name: Q
) -> TCResult<<Self::File as File>::BlockWrite>
where
Q: Borrow<<Self::File as File>::Key> + Send + Sync;
fn read_block_owned<'async_trait, Q>(
self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockRead>> + Send + 'async_trait>>
where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
{ ... }
fn try_read_block_owned<Q>(
self,
name: Q
) -> TCResult<<Self::File as File>::BlockRead>
where
Q: Borrow<<Self::File as File>::Key> + Send + Sync,
{ ... }
}
Expand description
A read lock on a File
Required Associated Types§
Required Methods§
sourcefn block_ids(&self) -> BTreeSet<<Self::File as File>::Key>
fn block_ids(&self) -> BTreeSet<<Self::File as File>::Key>
Return the set of names of each block in this File
.
sourcefn contains<Q>(&self, name: Q) -> boolwhere
Q: Borrow<<Self::File as File>::Key>,
fn contains<Q>(&self, name: Q) -> boolwhere
Q: Borrow<<Self::File as File>::Key>,
Return true
if this File
contains a block with the given name
.
sourcefn read_block<'life0, 'async_trait, Q>(
&'life0 self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockRead>> + Send + 'async_trait>>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn read_block<'life0, 'async_trait, Q>(
&'life0 self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockRead>> + Send + 'async_trait>>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Lock the block at name
for reading.
sourcefn try_read_block<Q>(&self, name: Q) -> TCResult<<Self::File as File>::BlockRead>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync,
fn try_read_block<Q>(&self, name: Q) -> TCResult<<Self::File as File>::BlockRead>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync,
Lock the block at name
for reading synchronously, if possible.
sourcefn read_block_exclusive<'life0, 'async_trait, Q>(
&'life0 self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockReadExclusive>> + Send + 'async_trait>>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn read_block_exclusive<'life0, 'async_trait, Q>(
&'life0 self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockReadExclusive>> + Send + 'async_trait>>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Lock the block at name
for reading exclusively,
i.e. prevent any more read locks being acquired while this one is active.
sourcefn try_read_block_exclusive<Q>(
&self,
name: Q
) -> TCResult<<Self::File as File>::BlockReadExclusive>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync,
fn try_read_block_exclusive<Q>(
&self,
name: Q
) -> TCResult<<Self::File as File>::BlockReadExclusive>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync,
Lock the block at name
for reading exclusively, synchronously if possible,
sourcefn write_block<'life0, 'async_trait, Q>(
&'life0 self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockWrite>> + Send + 'async_trait>>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn write_block<'life0, 'async_trait, Q>(
&'life0 self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockWrite>> + Send + 'async_trait>>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Lock the block at name
for writing.
Provided Methods§
sourcefn read_block_owned<'async_trait, Q>(
self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockRead>> + Send + 'async_trait>>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
fn read_block_owned<'async_trait, Q>(
self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockRead>> + Send + 'async_trait>>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
Lock the block at name
for reading, without borrowing.