pub trait IrohRecord: Sized {
type Id: RecordKey;
// Required methods
fn schema() -> Result<SchemaDescriptor, RecordError>;
fn id(&self) -> &Self::Id;
fn encode_record(&self) -> Result<Vec<u8>, RecordError>;
fn decode_record(bytes: &[u8]) -> Result<Self, RecordError>;
fn field_values(&self, field_id: u32) -> Result<Vec<Vec<u8>>, RecordError>;
// Provided methods
fn record_id(&self) -> Result<Vec<u8>, RecordError> { ... }
fn merge_record(&mut self, _other: &Self) -> Result<(), RecordError> { ... }
fn canonicalize_causality(
&mut self,
_author: AuthorId,
_sequence: u64,
_context: &VersionVector,
_next_operation: &mut u32,
) -> Result<(), RecordError> { ... }
}Expand description
Strongly typed record contract generated by #[derive(IrohRecord)].
Required Associated Types§
Required Methods§
Sourcefn schema() -> Result<SchemaDescriptor, RecordError>
fn schema() -> Result<SchemaDescriptor, RecordError>
Returns the validated durable schema descriptor.
Sourcefn encode_record(&self) -> Result<Vec<u8>, RecordError>
fn encode_record(&self) -> Result<Vec<u8>, RecordError>
Encodes all record fields in stable numeric-field order.
Sourcefn decode_record(bytes: &[u8]) -> Result<Self, RecordError>
fn decode_record(bytes: &[u8]) -> Result<Self, RecordError>
Strictly decodes a complete typed record.
Sourcefn field_values(&self, field_id: u32) -> Result<Vec<Vec<u8>>, RecordError>
fn field_values(&self, field_id: u32) -> Result<Vec<Vec<u8>>, RecordError>
Returns canonical visible values for one field, or an empty set if unknown.
Provided Methods§
Sourcefn record_id(&self) -> Result<Vec<u8>, RecordError>
fn record_id(&self) -> Result<Vec<u8>, RecordError>
Encodes the canonical primary key used by storage and indexes.
Sourcefn merge_record(&mut self, _other: &Self) -> Result<(), RecordError>
fn merge_record(&mut self, _other: &Self) -> Result<(), RecordError>
Merges every replicated field from another incarnation of the same record.
Sourcefn canonicalize_causality(
&mut self,
_author: AuthorId,
_sequence: u64,
_context: &VersionVector,
_next_operation: &mut u32,
) -> Result<(), RecordError>
fn canonicalize_causality( &mut self, _author: AuthorId, _sequence: u64, _context: &VersionVector, _next_operation: &mut u32, ) -> Result<(), RecordError>
Reissues every replicated field identity from one authenticated commit.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.