Trait tc_transact::fs::FileWrite
source · pub trait FileWrite: FileRead {
fn downgrade(self) -> <Self::File as File>::ReadExclusive;
fn create_block<'life0, 'async_trait>(
&'life0 mut self,
name: <Self::File as File>::Key,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockWrite>> + Send + 'async_trait>>
where
Self: 'async_trait,
'life0: 'async_trait;
fn try_create_block(
&mut self,
name: <Self::File as File>::Key,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> TCResult<<Self::File as File>::BlockWrite>;
fn create_block_unique<'life0, 'async_trait>(
&'life0 mut self,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> Pin<Box<dyn Future<Output = TCResult<(<Self::File as File>::Key, <Self::File as File>::BlockWrite)>> + Send + 'async_trait>>
where
Self: 'async_trait,
'life0: 'async_trait;
fn try_create_block_unique(
&mut self,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> TCResult<(<Self::File as File>::Key, <Self::File as File>::BlockWrite)>;
fn delete_block<'life0, 'async_trait, Q>(
&'life0 mut self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>
where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
fn try_delete_block<Q>(&mut self, name: Q) -> TCResult<()>
where
Q: Borrow<<Self::File as File>::Key> + Send + Sync;
fn copy_from<'life0, 'life1, 'async_trait, O>(
&'life0 mut self,
other: &'life1 O,
truncate: bool
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>
where
O: FileRead + 'async_trait,
O::File: File<Key = <Self::File as File>::Key, Block = <Self::File as File>::Block>,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn try_copy_from<O>(&mut self, other: &O, truncate: bool) -> TCResult<()>
where
O: FileRead,
O::File: File<Key = <Self::File as File>::Key, Block = <Self::File as File>::Block>;
fn truncate<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>
where
Self: 'async_trait,
'life0: 'async_trait;
fn try_truncate(&mut self) -> TCResult<()>;
}
Expand description
A write lock on a File
Required Methods§
sourcefn downgrade(self) -> <Self::File as File>::ReadExclusive
fn downgrade(self) -> <Self::File as File>::ReadExclusive
Downgrade this write lock to an exclusive read lock.
sourcefn create_block<'life0, 'async_trait>(
&'life0 mut self,
name: <Self::File as File>::Key,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockWrite>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_block<'life0, 'async_trait>(
&'life0 mut self,
name: <Self::File as File>::Key,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> Pin<Box<dyn Future<Output = TCResult<<Self::File as File>::BlockWrite>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new block.
sourcefn try_create_block(
&mut self,
name: <Self::File as File>::Key,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> TCResult<<Self::File as File>::BlockWrite>
fn try_create_block(
&mut self,
name: <Self::File as File>::Key,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> TCResult<<Self::File as File>::BlockWrite>
Create a new block synchronously, if possible.
sourcefn create_block_unique<'life0, 'async_trait>(
&'life0 mut self,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> Pin<Box<dyn Future<Output = TCResult<(<Self::File as File>::Key, <Self::File as File>::BlockWrite)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_block_unique<'life0, 'async_trait>(
&'life0 mut self,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> Pin<Box<dyn Future<Output = TCResult<(<Self::File as File>::Key, <Self::File as File>::BlockWrite)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new block with a unique random name.
sourcefn try_create_block_unique(
&mut self,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> TCResult<(<Self::File as File>::Key, <Self::File as File>::BlockWrite)>
fn try_create_block_unique(
&mut self,
initial_value: <Self::File as File>::Block,
size_hint: usize
) -> TCResult<(<Self::File as File>::Key, <Self::File as File>::BlockWrite)>
Create a new block with a unique random name, synchronously if possible.
sourcefn delete_block<'life0, 'async_trait, Q>(
&'life0 mut self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn delete_block<'life0, 'async_trait, Q>(
&'life0 mut self,
name: Q
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Delete the block with the given name
.
sourcefn try_delete_block<Q>(&mut self, name: Q) -> TCResult<()>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync,
fn try_delete_block<Q>(&mut self, name: Q) -> TCResult<()>where
Q: Borrow<<Self::File as File>::Key> + Send + Sync,
Delete the block with the given name
synchronously, if possible.
sourcefn copy_from<'life0, 'life1, 'async_trait, O>(
&'life0 mut self,
other: &'life1 O,
truncate: bool
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
O: FileRead + 'async_trait,
O::File: File<Key = <Self::File as File>::Key, Block = <Self::File as File>::Block>,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn copy_from<'life0, 'life1, 'async_trait, O>(
&'life0 mut self,
other: &'life1 O,
truncate: bool
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
O: FileRead + 'async_trait,
O::File: File<Key = <Self::File as File>::Key, Block = <Self::File as File>::Block>,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Copy blocks from the other
file into this File
.
If truncate
is true
, the destination file will first be truncated.
sourcefn try_copy_from<O>(&mut self, other: &O, truncate: bool) -> TCResult<()>where
O: FileRead,
O::File: File<Key = <Self::File as File>::Key, Block = <Self::File as File>::Block>,
fn try_copy_from<O>(&mut self, other: &O, truncate: bool) -> TCResult<()>where
O: FileRead,
O::File: File<Key = <Self::File as File>::Key, Block = <Self::File as File>::Block>,
Copy blocks from the other
file into this File
synchronously, if possible.
If truncate
is true
, the destination file will first be truncated.
sourcefn truncate<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn truncate<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete all of this File
’s blocks.
sourcefn try_truncate(&mut self) -> TCResult<()>
fn try_truncate(&mut self) -> TCResult<()>
Delete all of this File
’s blocks synchronously, if possible.