proof_of_sql/base/database/
test_accessor.rs

1use super::{CommitmentAccessor, DataAccessor, MetadataAccessor, SchemaAccessor, TableRef};
2use crate::base::commitment::Commitment;
3use alloc::vec::Vec;
4
5/// A trait that defines the interface for a combined metadata, schema, commitment, and data accessor for unit testing or example purposes.
6pub trait TestAccessor<C: Commitment>:
7    Clone
8    + Default
9    + MetadataAccessor
10    + SchemaAccessor
11    + CommitmentAccessor<C>
12    + DataAccessor<C::Scalar>
13{
14    /// The table type that the accessor will accept in the `add_table` method, and likely the inner table type.
15    type Table;
16
17    /// Create an empty test accessor
18    fn new_empty() -> Self;
19
20    /// Add a new table to the current test accessor
21    fn add_table(&mut self, table_ref: TableRef, data: Self::Table, table_offset: usize);
22
23    /// Get the column names for a given table
24    fn get_column_names(&self, table_ref: &TableRef) -> Vec<&str>;
25
26    /// Update the table offset alongside its column commitments
27    fn update_offset(&mut self, table_ref: &TableRef, new_offset: usize);
28}