Struct tc_transact::fs::File
source · pub struct File<FE, B> { /* private fields */ }
Expand description
A transactional file
Implementations§
source§impl<FE, B> File<FE, B>
impl<FE, B> File<FE, B>
sourcepub fn into_inner(self) -> Inner<FE>
pub fn into_inner(self) -> Inner<FE>
Destructure this File
into its underlying freqfs::DirLock
.
source§impl<FE, B> File<FE, B>
impl<FE, B> File<FE, B>
sourcepub async fn block_ids(
&self,
txn_id: TxnId
) -> TCResult<impl Iterator<Item = Key>>
pub async fn block_ids( &self, txn_id: TxnId ) -> TCResult<impl Iterator<Item = Key>>
Construct an iterator over the name of each block in this File
at txn_id
.
sourcepub async fn create_block(
&self,
txn_id: TxnId,
name: Id,
contents: B
) -> TCResult<BlockWrite<FE, B>>
pub async fn create_block( &self, txn_id: TxnId, name: Id, contents: B ) -> TCResult<BlockWrite<FE, B>>
Create a new block at txn_id
with the given name
and contents
.
sourcepub async fn delete_block(&self, txn_id: TxnId, name: Id) -> TCResult<bool>
pub async fn delete_block(&self, txn_id: TxnId, name: Id) -> TCResult<bool>
Delete the block with the given name
at txn_id
and return true
if it was present.
sourcepub async fn iter(
&self,
txn_id: TxnId
) -> TCResult<impl Stream<Item = TCResult<(Key, BlockRead<FE, B>)>> + Send + Unpin + '_>
pub async fn iter( &self, txn_id: TxnId ) -> TCResult<impl Stream<Item = TCResult<(Key, BlockRead<FE, B>)>> + Send + Unpin + '_>
Iterate over the blocks in this File
.
sourcepub async fn read_block(
&self,
txn_id: TxnId,
name: &Id
) -> TCResult<BlockRead<FE, B>>
pub async fn read_block( &self, txn_id: TxnId, name: &Id ) -> TCResult<BlockRead<FE, B>>
Lock the block at name
for reading at txn_id
.
sourcepub async fn write_block(
&self,
txn_id: TxnId,
name: &Id
) -> TCResult<BlockWrite<FE, B>>
pub async fn write_block( &self, txn_id: TxnId, name: &Id ) -> TCResult<BlockWrite<FE, B>>
Lock the block at name
for writing at txn_id
.
Trait Implementations§
source§impl<FE, B> Transact for File<FE, B>
impl<FE, B> Transact for File<FE, B>
source§fn commit<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = Self::Commit> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn commit<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = Self::Commit> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Commit this transaction.
Auto Trait Implementations§
impl<FE, B> !RefUnwindSafe for File<FE, B>
impl<FE, B> Send for File<FE, B>
impl<FE, B> Sync for File<FE, B>
impl<FE, B> Unpin for File<FE, B>where
B: Unpin,
impl<FE, B> !UnwindSafe for File<FE, B>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<F> Match for F
impl<F> Match for F
source§fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
Returns
true
if self
can be cast into the target type T
.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
source§fn can_cast_from(_: &F) -> bool
fn can_cast_from(_: &F) -> bool
Test if
value
can be cast into Self
.source§fn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.source§impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
source§fn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if
self
can be cast into T
.source§fn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns
Some(T)
if self
can be cast into T
, otherwise None
.