pub trait DataAccessor<S: Scalar>: MetadataAccessor {
// Required method
fn get_column(
&self,
table_ref: &TableRef,
column_id: &Ident,
) -> Column<'_, S>;
// Provided method
fn get_table(
&self,
table_ref: &TableRef,
column_ids: &IndexSet<Ident, BuildHasherDefault<AHasher>>,
) -> Table<'_, S> { ... }
}Expand description
Access database columns of an in-memory table span.
Prover uses this information to process a query.
In pseudo-code, here is a sketch of how DataAccessor fits in
with the prove workflow:
prove(query, database) {
if(!validate_query(query, database)) {
// if the query references columns that don't exist
// we should error here before going any further
invalid-query()
}
update-cached-columns(database, query)
// if the database represents an in-memory cache of an externally persisted
// database we should update the cache so that any column referenced in the query
// will be available
database.reader_lock()
// we can't be updating the database while proving
accessor <- make-data-accessor(database)
proof <- prove-valid-query(query, accessor)
database.reader_unlock()
return proof
}Note: we assume that the query has already been validated so that we will only be accessing information about columns that exist in the database.
Required Methods§
Sourcefn get_column(&self, table_ref: &TableRef, column_id: &Ident) -> Column<'_, S>
fn get_column(&self, table_ref: &TableRef, column_id: &Ident) -> Column<'_, S>
Return the data span in the table (not the full-table data)
Provided Methods§
Sourcefn get_table(
&self,
table_ref: &TableRef,
column_ids: &IndexSet<Ident, BuildHasherDefault<AHasher>>,
) -> Table<'_, S>
fn get_table( &self, table_ref: &TableRef, column_ids: &IndexSet<Ident, BuildHasherDefault<AHasher>>, ) -> Table<'_, S>
Creates a new Table from a TableRef and Idents.
Columns are retrieved from the DataAccessor using the provided TableRef and Idents.
The only reason why [table_ref] is needed is because [column_ids] can be empty.
§Panics
Column length mismatches can occur in theory. In practice, this should not happen.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<'a, CP: CommitmentEvaluationProof> DataAccessor<<CP as CommitmentEvaluationProof>::Scalar> for TableTestAccessor<'a, CP>
§Panics
Will panic if the table_ref is not found in self.tables, or if
the column_id is not found in the inner table for that reference,
indicating that an invalid column reference was provided.
impl<CP: CommitmentEvaluationProof> DataAccessor<<CP as CommitmentEvaluationProof>::Scalar> for OwnedTableTestAccessor<'_, CP>
§Panics
Will panic if the table_ref is not found in self.tables, or if
the column_id is not found in the inner table for that reference,
indicating that an invalid column reference was provided.