Struct proof_of_sql::base::commitment::TableCommitment
source · pub struct TableCommitment<C>where
Vec<C>: VecCommitmentExt,{ /* private fields */ }
Expand description
Commitment for an entire table, with column and table metadata.
Unlike ColumnCommitments
, all columns in this commitment must have the same length.
Implementations§
source§impl<C> TableCommitment<C>where
Vec<C>: VecCommitmentExt,
impl<C> TableCommitment<C>where
Vec<C>: VecCommitmentExt,
sourcepub fn from_accessor_with_max_bounds<A: CommitmentAccessor<<Vec<C> as VecCommitmentExt>::DecompressedCommitment>>(
table_ref: TableRef,
columns: &[ColumnField],
accessor: &A,
) -> Self
pub fn from_accessor_with_max_bounds<A: CommitmentAccessor<<Vec<C> as VecCommitmentExt>::DecompressedCommitment>>( table_ref: TableRef, columns: &[ColumnField], accessor: &A, ) -> Self
Create a new TableCommitment
for a table from a commitment accessor.
sourcepub fn try_new(
column_commitments: ColumnCommitments<C>,
range: Range<usize>,
) -> Result<Self, NegativeRange>
pub fn try_new( column_commitments: ColumnCommitments<C>, range: Range<usize>, ) -> Result<Self, NegativeRange>
Construct a new TableCommitment
.
Will error if the range is “negative”, i.e. if its end < start.
sourcepub fn column_commitments(&self) -> &ColumnCommitments<C>
pub fn column_commitments(&self) -> &ColumnCommitments<C>
Returns a reference to this type’s internal ColumnCommitments
.
sourcepub fn range(&self) -> &Range<usize>
pub fn range(&self) -> &Range<usize>
Returns a reference to the range of rows this type commits to.
sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
Returns the number of columns in the committed table.
sourcepub fn try_from_columns_with_offset<'a, COL>(
columns: impl IntoIterator<Item = (&'a Identifier, COL)>,
offset: usize,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> Result<TableCommitment<C>, TableCommitmentFromColumnsError>where
COL: Into<CommittableColumn<'a>>,
pub fn try_from_columns_with_offset<'a, COL>(
columns: impl IntoIterator<Item = (&'a Identifier, COL)>,
offset: usize,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> Result<TableCommitment<C>, TableCommitmentFromColumnsError>where
COL: Into<CommittableColumn<'a>>,
Returns a TableCommitment
to the provided columns with the given row offset.
Provided columns must have the same length and no duplicate identifiers.
sourcepub fn from_owned_table_with_offset<S>(
owned_table: &OwnedTable<S>,
offset: usize,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> TableCommitment<C>where
S: Scalar,
pub fn from_owned_table_with_offset<S>(
owned_table: &OwnedTable<S>,
offset: usize,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> TableCommitment<C>where
S: Scalar,
Returns a TableCommitment
to the provided table with the given row offset.
sourcepub fn try_append_rows<'a, COL>(
&mut self,
columns: impl IntoIterator<Item = (&'a Identifier, COL)>,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> Result<(), AppendTableCommitmentError>where
COL: Into<CommittableColumn<'a>>,
pub fn try_append_rows<'a, COL>(
&mut self,
columns: impl IntoIterator<Item = (&'a Identifier, COL)>,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> Result<(), AppendTableCommitmentError>where
COL: Into<CommittableColumn<'a>>,
Append rows of data from the provided columns to the existing TableCommitment
.
The row offset is assumed to be the end of the TableCommitment
’s current range.
Will error on a variety of mismatches, or if the provided columns have mixed length.
sourcepub fn append_owned_table<S>(
&mut self,
owned_table: &OwnedTable<S>,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> Result<(), ColumnCommitmentsMismatch>where
S: Scalar,
pub fn append_owned_table<S>(
&mut self,
owned_table: &OwnedTable<S>,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> Result<(), ColumnCommitmentsMismatch>where
S: Scalar,
Append data of the provided table to the exiting TableCommitment
.
Will error on a variety of mismatches.
See ColumnCommitmentsMismatch
for an enumeration of these errors.
sourcepub fn try_extend_columns<'a, COL>(
&mut self,
columns: impl IntoIterator<Item = (&'a Identifier, COL)>,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> Result<(), TableCommitmentFromColumnsError>where
COL: Into<CommittableColumn<'a>>,
pub fn try_extend_columns<'a, COL>(
&mut self,
columns: impl IntoIterator<Item = (&'a Identifier, COL)>,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> Result<(), TableCommitmentFromColumnsError>where
COL: Into<CommittableColumn<'a>>,
Add new columns to this TableCommitment
.
Columns must have the same length as the current commitment and no duplicate identifiers.
sourcepub fn try_add(
self,
other: Self,
) -> Result<Self, TableCommitmentArithmeticError>where
Self: Sized,
pub fn try_add(
self,
other: Self,
) -> Result<Self, TableCommitmentArithmeticError>where
Self: Sized,
Add two TableCommitment
s together.
self
must end where other
begins, or vice versa.
Otherwise, TableCommitmentArithmeticError::NonContiguous
is returned.
This will also error on a variety of mismatches.
See ColumnCommitmentsMismatch
for an enumeration of these errors.
sourcepub fn try_sub(
self,
other: Self,
) -> Result<Self, TableCommitmentArithmeticError>where
Self: Sized,
pub fn try_sub(
self,
other: Self,
) -> Result<Self, TableCommitmentArithmeticError>where
Self: Sized,
Subtract two TableCommitment
s.
self
and other
must begin at the same row number or end at the same row number.
Otherwise, TableCommitmentArithmeticError::NonContiguous
is returned.
Furthermore, other
’s range must be smaller or equal to self
’s.
Otherwise, TableCommitmentArithmeticError::NegativeRange
is returned.
This will also error on a variety of mismatches.
See ColumnCommitmentsMismatch
for an enumeration of these errors.
sourcepub fn try_append_record_batch(
&mut self,
batch: &RecordBatch,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> Result<(), AppendRecordBatchTableCommitmentError>
pub fn try_append_record_batch( &mut self, batch: &RecordBatch, setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>, ) -> Result<(), AppendRecordBatchTableCommitmentError>
Append an arrow RecordBatch
to the existing TableCommitment
.
The row offset is assumed to be the end of the TableCommitment
’s current range.
Will error on a variety of mismatches, or if the provided columns have mixed length.
sourcepub fn try_from_record_batch(
batch: &RecordBatch,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> Result<TableCommitment<C>, RecordBatchToColumnsError>
pub fn try_from_record_batch( batch: &RecordBatch, setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>, ) -> Result<TableCommitment<C>, RecordBatchToColumnsError>
Returns a TableCommitment
to the provided arrow RecordBatch
.
sourcepub fn try_from_record_batch_with_offset(
batch: &RecordBatch,
offset: usize,
setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>,
) -> Result<TableCommitment<C>, RecordBatchToColumnsError>
pub fn try_from_record_batch_with_offset( batch: &RecordBatch, offset: usize, setup: &<Vec<C> as VecCommitmentExt>::CommitmentPublicSetup<'_>, ) -> Result<TableCommitment<C>, RecordBatchToColumnsError>
Returns a TableCommitment
to the provided arrow RecordBatch
with the given row offset.
Trait Implementations§
source§impl<C: Clone> Clone for TableCommitment<C>where
Vec<C>: VecCommitmentExt,
impl<C: Clone> Clone for TableCommitment<C>where
Vec<C>: VecCommitmentExt,
source§fn clone(&self) -> TableCommitment<C>
fn clone(&self) -> TableCommitment<C>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<C: Debug> Debug for TableCommitment<C>where
Vec<C>: VecCommitmentExt,
impl<C: Debug> Debug for TableCommitment<C>where
Vec<C>: VecCommitmentExt,
source§impl<C: Default> Default for TableCommitment<C>where
Vec<C>: VecCommitmentExt,
impl<C: Default> Default for TableCommitment<C>where
Vec<C>: VecCommitmentExt,
source§fn default() -> TableCommitment<C>
fn default() -> TableCommitment<C>
source§impl<'de, C> Deserialize<'de> for TableCommitment<C>
impl<'de, C> Deserialize<'de> for TableCommitment<C>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<C: PartialEq> PartialEq for TableCommitment<C>where
Vec<C>: VecCommitmentExt,
impl<C: PartialEq> PartialEq for TableCommitment<C>where
Vec<C>: VecCommitmentExt,
source§fn eq(&self, other: &TableCommitment<C>) -> bool
fn eq(&self, other: &TableCommitment<C>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<C> Serialize for TableCommitment<C>
impl<C> Serialize for TableCommitment<C>
impl<C: Eq> Eq for TableCommitment<C>where
Vec<C>: VecCommitmentExt,
impl<C> StructuralPartialEq for TableCommitment<C>where
Vec<C>: VecCommitmentExt,
Auto Trait Implementations§
impl<C> Freeze for TableCommitment<C>
impl<C> RefUnwindSafe for TableCommitment<C>where
C: RefUnwindSafe,
impl<C> Send for TableCommitment<C>where
C: Send,
impl<C> Sync for TableCommitment<C>where
C: Sync,
impl<C> Unpin for TableCommitment<C>where
C: Unpin,
impl<C> UnwindSafe for TableCommitment<C>where
C: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more