Struct tc_transact::fs::Dir
source · pub struct Dir<FE> { /* private fields */ }Expand description
A transactional directory
Implementations§
source§impl<FE: ThreadSafe + Clone> Dir<FE>
impl<FE: ThreadSafe + Clone> Dir<FE>
sourcepub async fn load(txn_id: TxnId, canon: DirLock<FE>) -> TCResult<Self>
pub async fn load(txn_id: TxnId, canon: DirLock<FE>) -> TCResult<Self>
Load a transactional Dir from the filesystem cache.
sourcepub fn into_inner(self) -> Inner<FE>
pub fn into_inner(self) -> Inner<FE>
Destructure this Dir into its underlying freqfs::DirLock.
sourcepub async fn contains(&self, txn_id: TxnId, name: &Id) -> TCResult<bool>
pub async fn contains(&self, txn_id: TxnId, name: &Id) -> TCResult<bool>
Check whether this Dir has an entry with the given name at txn_id.
sourcepub async fn create_dir(&self, txn_id: TxnId, name: Id) -> TCResult<Self>
pub async fn create_dir(&self, txn_id: TxnId, name: Id) -> TCResult<Self>
Create a new sub-directory with the given name at txn_id.
sourcepub async fn create_file<B>(
&self,
txn_id: TxnId,
name: Id
) -> TCResult<File<FE, B>>
pub async fn create_file<B>( &self, txn_id: TxnId, name: Id ) -> TCResult<File<FE, B>>
Create a new File with the given name at txn_id.
sourcepub async fn entry_names(
&self,
txn_id: TxnId
) -> TCResult<impl Iterator<Item = Key>>
pub async fn entry_names( &self, txn_id: TxnId ) -> TCResult<impl Iterator<Item = Key>>
Iterate over the names of the entries in this Dir at txn_id.
sourcepub async fn files<B>(
&self,
txn_id: TxnId
) -> TCResult<impl Iterator<Item = (Key, File<FE, B>)>>
pub async fn files<B>( &self, txn_id: TxnId ) -> TCResult<impl Iterator<Item = (Key, File<FE, B>)>>
sourcepub async fn get_dir(&self, txn_id: TxnId, name: &Id) -> TCResult<Self>
pub async fn get_dir(&self, txn_id: TxnId, name: &Id) -> TCResult<Self>
Get the sub-Dir with the given name at txn_id, or return a “not found” error.
sourcepub async fn get_or_create_dir(&self, txn_id: TxnId, name: Id) -> TCResult<Self>
pub async fn get_or_create_dir(&self, txn_id: TxnId, name: Id) -> TCResult<Self>
Get the sub-Dir with the given name at txn_id, or create a new one.
sourcepub async fn get_file<B>(
&self,
txn_id: TxnId,
name: &Id
) -> TCResult<File<FE, B>>
pub async fn get_file<B>( &self, txn_id: TxnId, name: &Id ) -> TCResult<File<FE, B>>
Get the File with the given name at txn_id, or return a “not found” error.
sourcepub async fn is_empty(&self, txn_id: TxnId) -> TCResult<bool>
pub async fn is_empty(&self, txn_id: TxnId) -> TCResult<bool>
Return true if this Dir is empty at txn_id.
Trait Implementations§
Auto Trait Implementations§
impl<FE> !RefUnwindSafe for Dir<FE>
impl<FE> Send for Dir<FE>
impl<FE> Sync for Dir<FE>
impl<FE> Unpin for Dir<FE>
impl<FE> !UnwindSafe for Dir<FE>
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.