Struct tc_table::TableIndex
source · pub struct TableIndex<F, D, Txn> { /* private fields */ }
Expand description
The base type of a Table
.
Implementations§
source§impl<F, D, Txn> TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
impl<F, D, Txn> TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
sourcepub async fn is_empty(&self, txn: &Txn) -> TCResult<bool>
pub async fn is_empty(&self, txn: &Txn) -> TCResult<bool>
Return true
if this table has zero rows.
sourcepub fn supporting_index(&self, bounds: &Bounds) -> TCResult<Index<F, D, Txn>>
pub fn supporting_index(&self, bounds: &Bounds) -> TCResult<Index<F, D, Txn>>
Return an index which supports the given Bounds
, or an error if there is none.
sourcepub async fn slice_rows<'a>(
self,
txn_id: TxnId,
bounds: Bounds,
reverse: bool
) -> TCResult<TCBoxTryStream<'a, Vec<Value>>>
pub async fn slice_rows<'a>(
self,
txn_id: TxnId,
bounds: Bounds,
reverse: bool
) -> TCResult<TCBoxTryStream<'a, Vec<Value>>>
Stream the rows within the given Bounds
from the primary index of this TableIndex
.
Trait Implementations§
source§impl<F: Clone, D: Clone, Txn: Clone> Clone for TableIndex<F, D, Txn>
impl<F: Clone, D: Clone, Txn: Clone> Clone for TableIndex<F, D, Txn>
source§fn clone(&self) -> TableIndex<F, D, Txn>
fn clone(&self) -> TableIndex<F, D, Txn>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<F, D, Txn, I> CopyFrom<D, I> for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
D: Dir + TryFrom<D::Store, Error = TCError>,
Txn: Transaction<D>,
I: TableStream + 'static,
D::Read: DirReadFile<F>,
D::Write: DirCreateFile<F>,
D::Store: From<F>,
impl<F, D, Txn, I> CopyFrom<D, I> for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
D: Dir + TryFrom<D::Store, Error = TCError>,
Txn: Transaction<D>,
I: TableStream + 'static,
D::Read: DirReadFile<F>,
D::Write: DirCreateFile<F>,
D::Store: From<F>,
source§impl<F: File<Key = NodeId, Block = Node>, D: Dir, Txn: Transaction<D>> Display for TableIndex<F, D, Txn>
impl<F: File<Key = NodeId, Block = Node>, D: Dir, Txn: Transaction<D>> Display for TableIndex<F, D, Txn>
source§impl<F, D, Txn> From<TableIndex<F, D, Txn>> for Table<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
impl<F, D, Txn> From<TableIndex<F, D, Txn>> for Table<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
source§fn from(table: TableIndex<F, D, Txn>) -> Self
fn from(table: TableIndex<F, D, Txn>) -> Self
Converts to this type from the input type.
source§impl<F, D, Txn> FromStream for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
D: Dir + TryFrom<D::Store, Error = TCError>,
Txn: Transaction<D>,
D::Read: DirReadFile<F>,
D::Write: DirCreateFile<F>,
D::Store: From<D> + From<F>,
impl<F, D, Txn> FromStream for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
D: Dir + TryFrom<D::Store, Error = TCError>,
Txn: Transaction<D>,
D::Read: DirReadFile<F>,
D::Write: DirCreateFile<F>,
D::Store: From<D> + From<F>,
source§impl<F, D, Txn> Persist<D> for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
D: Dir + TryFrom<D::Store, Error = TCError>,
Txn: Transaction<D>,
D::Read: DirReadFile<F>,
D::Write: DirCreateFile<F>,
D::Store: From<F>,
impl<F, D, Txn> Persist<D> for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
D: Dir + TryFrom<D::Store, Error = TCError>,
Txn: Transaction<D>,
D::Read: DirReadFile<F>,
D::Write: DirCreateFile<F>,
D::Store: From<F>,
type Txn = Txn
type Schema = TableSchema
source§fn create(txn_id: TxnId, schema: Self::Schema, store: D::Store) -> TCResult<Self>
fn create(txn_id: TxnId, schema: Self::Schema, store: D::Store) -> TCResult<Self>
Create a new instance of
Self
from an empty Store
.source§fn load(txn_id: TxnId, schema: Self::Schema, store: D::Store) -> TCResult<Self>
fn load(txn_id: TxnId, schema: Self::Schema, store: D::Store) -> TCResult<Self>
Load a saved instance of
Self
from persistent storage.
Should only be invoked at startup time.source§impl<F, D, Txn> Restore<D> for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
D: Dir + TryFrom<D::Store, Error = TCError>,
Txn: Transaction<D>,
D::Read: DirReadFile<F>,
D::Write: DirCreateFile<F>,
D::Store: From<F>,
impl<F, D, Txn> Restore<D> for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
D: Dir + TryFrom<D::Store, Error = TCError>,
Txn: Transaction<D>,
D::Read: DirReadFile<F>,
D::Write: DirCreateFile<F>,
D::Store: From<F>,
source§impl<F, D, Txn> TableInstance for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
impl<F, D, Txn> TableInstance for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
source§impl<F, D, Txn> TableOrder for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
impl<F, D, Txn> TableOrder for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
source§impl<F, D, Txn> TableRead for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
impl<F, D, Txn> TableRead for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
source§impl<F, D, Txn> TableSlice for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
impl<F, D, Txn> TableSlice for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
source§impl<F, D, Txn> TableStream for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
impl<F, D, Txn> TableStream for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
type Limit = Limited<F, D, Txn>
type Selection = Selection<F, D, Txn, TableIndex<F, D, Txn>>
source§fn count<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
fn count<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
Return the number of rows in this
Table
.source§impl<F, D, Txn> TableWrite for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
impl<F, D, Txn> TableWrite for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node>,
D: Dir,
Txn: Transaction<D>,
source§fn delete<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
key: Key
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
key: Key
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete the given
Row
from this table, if present.source§impl<F, D, Txn> Transact for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node> + Transact<Commit = Option<TxnLockCommit<BTreeMap<NodeId, TxnLock<TxnId>>>>>,
D: Dir,
Txn: Transaction<D>,
impl<F, D, Txn> Transact for TableIndex<F, D, Txn>where
F: File<Key = NodeId, Block = Node> + Transact<Commit = Option<TxnLockCommit<BTreeMap<NodeId, TxnLock<TxnId>>>>>,
D: Dir,
Txn: Transaction<D>,
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<F, D, Txn> !RefUnwindSafe for TableIndex<F, D, Txn>
impl<F, D, Txn> Send for TableIndex<F, D, Txn>where
D: Send + Sync,
F: Send + Sync,
Txn: Send + Sync,
impl<F, D, Txn> Sync for TableIndex<F, D, Txn>where
D: Send + Sync,
F: Send + Sync,
Txn: Send + Sync,
impl<F, D, Txn> Unpin for TableIndex<F, D, Txn>
impl<F, D, Txn> !UnwindSafe for TableIndex<F, D, Txn>
Blanket Implementations§
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
.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
.