use crate::document::DocumentId;
use crate::entry::{EntrySigned, LogId, SeqNum};
use crate::hash::Hash;
use crate::identity::Author;
use crate::operation::{Operation, OperationEncoded};
use crate::schema::SchemaId;
use crate::Validate;
pub trait AsStorageEntry:
Sized + Clone + Send + Sync + Validate + PartialEq + std::fmt::Debug
{
type AsStorageEntryError: 'static + std::error::Error + Send + Sync;
fn new(
entry: &EntrySigned,
operation: &OperationEncoded,
) -> Result<Self, Self::AsStorageEntryError>;
fn author(&self) -> Author;
fn hash(&self) -> Hash;
fn entry_bytes(&self) -> Vec<u8>;
fn backlink_hash(&self) -> Option<Hash>;
fn skiplink_hash(&self) -> Option<Hash>;
fn seq_num(&self) -> SeqNum;
fn log_id(&self) -> LogId;
fn operation(&self) -> Operation;
}
pub trait AsStorageLog: Sized + Send + Sync {
fn new(author: &Author, schema: &SchemaId, document: &DocumentId, log_id: &LogId) -> Self;
fn id(&self) -> LogId;
fn author(&self) -> Author;
fn document_id(&self) -> DocumentId;
fn schema_id(&self) -> SchemaId;
}