Skip to main content

TableShell

Trait TableShell 

Source
pub trait TableShell:
    Send
    + Sync
    + 'static {
Show 29 methods // Required methods fn columns(&self) -> &IndexMap<String, Column>; fn references(&self) -> &IndexMap<String, Reference>; fn id_column(&self) -> Option<&str>; fn list_vista_values<'life0, 'life1, 'async_trait>( &'life0 self, vista: &'life1 Vista, ) -> Pin<Box<dyn Future<Output = Result<IndexMap<String, Record<CborValue>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_vista_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, vista: &'life1 Vista, id: &'life2 String, ) -> Pin<Box<dyn Future<Output = Result<Option<Record<CborValue>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_vista_some_value<'life0, 'life1, 'async_trait>( &'life0 self, vista: &'life1 Vista, ) -> Pin<Box<dyn Future<Output = Result<Option<(String, Record<CborValue>)>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn capabilities(&self) -> &VistaCapabilities; // Provided methods fn stream_vista_values<'a>( &'a self, vista: &'a Vista, ) -> Pin<Box<dyn Stream<Item = Result<(String, Record<CborValue>)>> + Send + 'a>> where Self: Sync { ... } fn insert_vista_value<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _id: &'life2 String, _record: &'life3 Record<CborValue>, ) -> Pin<Box<dyn Future<Output = Result<Record<CborValue>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait { ... } fn replace_vista_value<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _id: &'life2 String, _record: &'life3 Record<CborValue>, ) -> Pin<Box<dyn Future<Output = Result<Record<CborValue>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait { ... } fn patch_vista_value<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _id: &'life2 String, _partial: &'life3 Record<CborValue>, ) -> Pin<Box<dyn Future<Output = Result<Record<CborValue>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait { ... } fn delete_vista_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _id: &'life2 String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn delete_vista_all_values<'life0, 'life1, 'async_trait>( &'life0 self, _vista: &'life1 Vista, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn insert_vista_return_id_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _record: &'life2 Record<CborValue>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn get_vista_count<'life0, 'life1, 'async_trait>( &'life0 self, vista: &'life1 Vista, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn add_eq_condition( &mut self, _field: &str, _value: &CborValue, ) -> Result<()> { ... } fn add_raw_condition( &mut self, _condition: Box<dyn Any + Send + Sync>, ) -> Result<()> { ... } fn set_page_size(&mut self, _size: usize) -> Result<()> { ... } fn fetch_page<'life0, 'life1, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _page: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, Record<CborValue>)>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn fetch_next<'life0, 'life1, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _token: Option<CborValue>, ) -> Pin<Box<dyn Future<Output = Result<(Vec<(String, Record<CborValue>)>, Option<CborValue>)>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn add_search(&mut self, _text: &str) -> Result<()> { ... } fn clear_search(&mut self) -> Result<()> { ... } fn add_order(&mut self, _field: &str, _dir: SortDirection) -> Result<()> { ... } fn clear_orders(&mut self) -> Result<()> { ... } fn get_ref(&self, relation: &str, _row: &Record<CborValue>) -> Result<Vista> { ... } fn get_ref_kinds(&self) -> Vec<(String, ReferenceKind)> { ... } fn driver_name(&self) -> &'static str { ... } fn capability_flag(&self, name: &str) -> bool { ... } fn default_error(&self, method: &str, capability: &str) -> VantageError { ... }
}
Expand description

Per-driver executor for a Vista.

Implementations live in driver crates (vantage-sqlite, vantage-mongodb, vantage-aws, etc.). Each method receives &Vista so the driver can read the current condition state, columns, and other metadata.

Id = String and Value = ciborium::Value at this boundary, so every driver’s native id (Mongo ObjectId, Surreal Thing, …) stringifies here. Methods are named with the _vista_ infix to mirror TableSource’s _table_ convention; Vista’s ValueSet impls delegate by stripping the infix.

id: &String (rather than &str) is intentional: the upstream vantage_dataset::ValueSet trait family fixes Id = String and uses &Self::Id in its signatures, so impls receive &String and forward it through unchanged.

Required Methods§

Source

fn columns(&self) -> &IndexMap<String, Column>

Source

fn references(&self) -> &IndexMap<String, Reference>

Source

fn id_column(&self) -> Option<&str>

Source

fn list_vista_values<'life0, 'life1, 'async_trait>( &'life0 self, vista: &'life1 Vista, ) -> Pin<Box<dyn Future<Output = Result<IndexMap<String, Record<CborValue>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_vista_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, vista: &'life1 Vista, id: &'life2 String, ) -> Pin<Box<dyn Future<Output = Result<Option<Record<CborValue>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_vista_some_value<'life0, 'life1, 'async_trait>( &'life0 self, vista: &'life1 Vista, ) -> Pin<Box<dyn Future<Output = Result<Option<(String, Record<CborValue>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn capabilities(&self) -> &VistaCapabilities

Provided Methods§

Source

fn stream_vista_values<'a>( &'a self, vista: &'a Vista, ) -> Pin<Box<dyn Stream<Item = Result<(String, Record<CborValue>)>> + Send + 'a>>
where Self: Sync,

Default implementation wraps list_vista_values. Drivers with native streaming (cursor-based queries, paginated REST APIs) override.

Source

fn insert_vista_value<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _id: &'life2 String, _record: &'life3 Record<CborValue>, ) -> Pin<Box<dyn Future<Output = Result<Record<CborValue>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source

fn replace_vista_value<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _id: &'life2 String, _record: &'life3 Record<CborValue>, ) -> Pin<Box<dyn Future<Output = Result<Record<CborValue>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source

fn patch_vista_value<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _id: &'life2 String, _partial: &'life3 Record<CborValue>, ) -> Pin<Box<dyn Future<Output = Result<Record<CborValue>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source

fn delete_vista_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _id: &'life2 String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn delete_vista_all_values<'life0, 'life1, 'async_trait>( &'life0 self, _vista: &'life1 Vista, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn insert_vista_return_id_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _record: &'life2 Record<CborValue>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_vista_count<'life0, 'life1, 'async_trait>( &'life0 self, vista: &'life1 Vista, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Default impl falls back to list_vista_values — drivers with native count (SELECT COUNT(*), etc.) override.

Source

fn add_eq_condition(&mut self, _field: &str, _value: &CborValue) -> Result<()>

Translate field == value into the driver’s native condition type and apply it to the wrapped table. The default impl returns Unimplemented — every driver is expected to override.

value is the universal CBOR carrier; the driver picks the appropriate translation (e.g. cbor_to_bson for Mongo, cbor → AnyCsvType for CSV).

Source

fn add_raw_condition( &mut self, _condition: Box<dyn Any + Send + Sync>, ) -> Result<()>

Push a driver-native condition into the wrapped table. The caller boxes the condition as dyn Any and the driver downcasts to its own T::Condition. Used by YAML-driven relation traversal, where the factory constructs a DeferredFn-bearing condition outside the value-set surface (which only accepts scalar eq) and pushes it through this channel. Default is Unimplemented.

Source

fn set_page_size(&mut self, _size: usize) -> Result<()>

Declare how many records constitute one page. Used by both fetch_page and fetch_next. Default returns default_error("set_page_size", "can_set_page_size").

Source

fn fetch_page<'life0, 'life1, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _page: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, Record<CborValue>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch a specific page (1-based) using offset-style pagination. The per-page count comes from the most recent set_page_size.

Drivers without random-access pagination (DynamoDB, most token-paginated REST APIs) leave the default in place, which produces Unsupported. Callers should branch on vista.capabilities().can_fetch_page first.

Source

fn fetch_next<'life0, 'life1, 'async_trait>( &'life0 self, _vista: &'life1 Vista, _token: Option<CborValue>, ) -> Pin<Box<dyn Future<Output = Result<(Vec<(String, Record<CborValue>)>, Option<CborValue>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cursor-style chain fetch. Pass None on the first call; pass the previous call’s returned token on subsequent calls. Returned token is None when the result set is exhausted.

The token is driver-private — its shape is whatever the backend finds convenient (DynamoDB LastEvaluatedKey as a CBOR map, REST nextToken as CborValue::Text, offset-based as CborValue::Integer). Consumers treat it as opaque and round-trip it back unchanged.

Default returns default_error("fetch_next", "can_fetch_next").

Apply a quicksearch filter — a single string the driver fans out across the columns it considers searchable (typically those flagged SEARCHABLE, but each driver decides).

Replace semantics: calling add_search again wipes the previous search filter before applying the new one. Default produces Unimplemented (when can_search: true) or Unsupported (when can_search: false).

Drop the search filter previously applied via add_search. Default mirrors add_search.

Source

fn add_order(&mut self, _field: &str, _dir: SortDirection) -> Result<()>

Push a single ORDER BY clause onto the wrapped table.

Vista’s add_order is replace-semantics: the driver shell should clear any previously-set order before pushing the new one. Default produces Unimplemented (when can_order: true) or Unsupported (when can_order: false).

Source

fn clear_orders(&mut self) -> Result<()>

Wipe every order clause. Default mirrors add_order.

Source

fn get_ref(&self, relation: &str, _row: &Record<CborValue>) -> Result<Vista>

Resolve a same-persistence relation using a known source row, returning the related table as a new Vista.

Drivers override by forwarding into the wrapped typed Table’s get_ref_from_row::<EmptyEntity>(relation, &native_row) and then wrapping the result back as a Vista through the driver’s factory. The default returns Unimplemented; cross-persistence refs are handled at the Vista layer via Vista::with_foreign before this trait method is reached.

Source

fn get_ref_kinds(&self) -> Vec<(String, ReferenceKind)>

Names + cardinalities of the shell’s same-persistence references. Derived from references by default; impls should rarely need to override.

Source

fn driver_name(&self) -> &'static str

Short human label for the underlying driver (e.g. "csv", "sqlite", "postgres", "mongodb"). Used for diagnostics and CLI output. Drivers should override; the default is a placeholder.

Source

fn capability_flag(&self, name: &str) -> bool

Look up a capability flag by name. Used by default_error to decide between Unsupported and Unimplemented. Drivers don’t normally need to override this.

Source

fn default_error(&self, method: &str, capability: &str) -> VantageError

Build the standard error returned by default trait method impls.

Picks the kind based on the capability flag: a true flag means the driver advertised support but didn’t override the method (placeholder → Unimplemented); a false flag means the driver honestly doesn’t claim the op (caller should have checked → Unsupported).

Both kinds emit a tracing::error! at construction with method, capability, source_type, and vista_name as structured fields.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§