pub trait FileRead<B: BlockData>: Sized + Send + Sync {
    type File: File<B>;

    fn block_ids(&self) -> HashSet<&BlockId>;
    fn contains(&self, block_id: &BlockId) -> bool;
    fn is_empty(&self) -> bool;
    fn read_block<'life0, 'async_trait, I>(
        &'life0 self,
        name: I
    ) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File<B>>::BlockRead>> + Send + 'async_trait>>
   where
        I: Borrow<BlockId> + Send + Sync,
        I: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn read_block_exclusive<'life0, 'async_trait, I>(
        &'life0 self,
        name: I
    ) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File<B>>::BlockReadExclusive>> + Send + 'async_trait>>
   where
        I: Borrow<BlockId> + Send + Sync,
        I: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn write_block<'life0, 'async_trait, I>(
        &'life0 self,
        name: I
    ) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File<B>>::BlockWrite>> + Send + 'async_trait>>
   where
        I: Borrow<BlockId> + Send + Sync,
        I: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn read_block_owned<'async_trait, I>(
        self,
        name: I
    ) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File<B>>::BlockRead>> + Send + 'async_trait>>
   where
        I: Borrow<BlockId> + Send + Sync,
        I: 'async_trait,
        Self: 'async_trait
, { ... } }
Expand description

A read lock on a File

Required Associated Types

The type of this File

Required Methods

Get the set of all BlockIds in this File.

Return true if this File contains the given block_id.

Return true if there are no blocks in this File.

Lock the block at name for reading.

Lock the block at name for reading exclusively, i.e. prevent any more read locks being aquired while this one is active.

Convenience method to lock the block at name for writing.

Provided Methods

Lock the block at name for reading, without borrowing.

Implementors