pub struct File<B> { /* private fields */ }
Expand description
A transactional file
Implementations
sourceimpl<B: BlockData> File<B> where
CacheBlock: AsType<B>,
impl<B: BlockData> File<B> where
CacheBlock: AsType<B>,
pub async fn new(canon: DirLock<CacheBlock>) -> TCResult<Self>
Trait Implementations
sourceimpl AsType<File<ChainBlock>> for FileEntry
impl AsType<File<ChainBlock>> for FileEntry
sourcefn as_type(&self) -> Option<&File<ChainBlock>>
fn as_type(&self) -> Option<&File<ChainBlock>>
Borrow this instance as an instance of T
if possible.
sourcefn as_type_mut(&mut self) -> Option<&mut File<ChainBlock>>
fn as_type_mut(&mut self) -> Option<&mut File<ChainBlock>>
Borrow this instance mutably as an instance of T
if possible.
sourcefn into_type(self) -> Option<File<ChainBlock>>
fn into_type(self) -> Option<File<ChainBlock>>
Convert this instance into an instance of T
if possible.
sourceimpl AsType<File<Node>> for FileEntry
impl AsType<File<Node>> for FileEntry
sourcefn as_type_mut(&mut self) -> Option<&mut File<Node>>
fn as_type_mut(&mut self) -> Option<&mut File<Node>>
Borrow this instance mutably as an instance of T
if possible.
sourceimpl AsType<File<Scalar>> for FileEntry
impl AsType<File<Scalar>> for FileEntry
sourceimpl<B> File<B> for File<B> where
B: BlockData,
CacheBlock: AsType<B>,
impl<B> File<B> for File<B> where
B: BlockData,
CacheBlock: AsType<B>,
type Read = FileReadGuard<CacheBlock, B>
type Read = FileReadGuard<CacheBlock, B>
A read Lock on a block in this file.
type Write = FileWriteGuard<CacheBlock, B>
type Write = FileWriteGuard<CacheBlock, B>
A read Lock on a block in this file.
sourcefn block_ids<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<HashSet<BlockId>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn block_ids<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<HashSet<BlockId>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Return the IDs of all this File
’s blocks.
sourcefn contains_block<'life0, 'life1, 'async_trait>(
&'life0 self,
txn_id: TxnId,
name: &'life1 BlockId
) -> Pin<Box<dyn Future<Output = TCResult<bool>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn contains_block<'life0, 'life1, 'async_trait>(
&'life0 self,
txn_id: TxnId,
name: &'life1 BlockId
) -> Pin<Box<dyn Future<Output = TCResult<bool>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
sourcefn copy_from<'life0, 'life1, 'async_trait>(
&'life0 self,
other: &'life1 Self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn copy_from<'life0, 'life1, 'async_trait>(
&'life0 self,
other: &'life1 Self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Copy all blocks from the source File
into this File
.
sourcefn create_block<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
block_id: BlockId,
initial_value: B,
size_hint: usize
) -> Pin<Box<dyn Future<Output = TCResult<Self::Write>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn create_block<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
block_id: BlockId,
initial_value: B,
size_hint: usize
) -> Pin<Box<dyn Future<Output = TCResult<Self::Write>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Create a new block. Read more
sourcefn create_block_unique<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
initial_value: B,
size_hint: usize
) -> Pin<Box<dyn Future<Output = TCResult<(BlockId, Self::Write)>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn create_block_unique<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
initial_value: B,
size_hint: usize
) -> Pin<Box<dyn Future<Output = TCResult<(BlockId, Self::Write)>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Create a new block. Read more
sourcefn delete_block<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
block_id: BlockId
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn delete_block<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
block_id: BlockId
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Delete the block with the given ID.
sourcefn read_block<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
block_id: BlockId
) -> Pin<Box<dyn Future<Output = TCResult<FileReadGuard<CacheBlock, B>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn read_block<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
block_id: BlockId
) -> Pin<Box<dyn Future<Output = TCResult<FileReadGuard<CacheBlock, B>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Get a read lock on the block at name
.
sourcefn read_block_owned<'async_trait>(
self,
txn_id: TxnId,
block_id: BlockId
) -> Pin<Box<dyn Future<Output = TCResult<FileReadGuard<CacheBlock, B>>> + Send + 'async_trait>> where
Self: 'async_trait,
fn read_block_owned<'async_trait>(
self,
txn_id: TxnId,
block_id: BlockId
) -> Pin<Box<dyn Future<Output = TCResult<FileReadGuard<CacheBlock, B>>> + Send + 'async_trait>> where
Self: 'async_trait,
Get a read lock on the block at name
, without borrowing.
sourcefn write_block<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
block_id: BlockId
) -> Pin<Box<dyn Future<Output = TCResult<FileWriteGuard<CacheBlock, B>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn write_block<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
block_id: BlockId
) -> Pin<Box<dyn Future<Output = TCResult<FileWriteGuard<CacheBlock, B>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Get a read lock on the block at name
as of TxnId
.
sourceimpl From<File<ChainBlock>> for FileEntry
impl From<File<ChainBlock>> for FileEntry
sourcefn from(file: File<ChainBlock>) -> Self
fn from(file: File<ChainBlock>) -> Self
Converts to this type from the input type.
sourceimpl<B> Transact for File<B> where
B: BlockData,
CacheBlock: AsType<B>,
impl<B> Transact for File<B> where
B: BlockData,
CacheBlock: AsType<B>,
Auto Trait Implementations
impl<B> !RefUnwindSafe for File<B>
impl<B> Send for File<B> where
B: Send,
impl<B> Sync for File<B> where
B: Sync,
impl<B> Unpin for File<B> where
B: Unpin,
impl<B> !UnwindSafe for File<B>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<F> Match for F
impl<F> Match for F
sourcefn matches<T>(&self) -> bool where
T: TryCastFrom<Self>,
fn matches<T>(&self) -> bool where
T: TryCastFrom<Self>,
Returns true
if self
can be cast into the target type T
.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<F, T> TryCastFrom<F> for T where
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for T where
T: CastFrom<F>,
sourcefn can_cast_from(&F) -> bool
fn can_cast_from(&F) -> bool
Test if value
can be cast into Self
.
sourcefn 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
.
sourcefn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
Returns Ok(Self)
if the source value can be cast into Self
, otherwise calls on_err
.
sourceimpl<F, T> TryCastInto<T> for F where
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for F where
T: TryCastFrom<F>,
sourcefn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if self
can be cast into T
.
sourcefn 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
.
sourcefn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
Returns Ok(T)
if self
can be cast into T
, otherwise calls on_err
.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more