use bincode::{Decode, Encode};
use super::address::RevisionId;
use super::error_record::OperationRevisionRange;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Encode, Decode)]
pub enum IntentOperationKind {
General,
Insert,
HypergraphWrite,
Custom(u32),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)]
pub struct IntentCheckpoint {
pub first_revision: RevisionId,
pub last_revision: RevisionId,
pub kind: IntentOperationKind,
}
impl IntentCheckpoint {
pub fn new(
first_revision: RevisionId,
last_revision: RevisionId,
kind: IntentOperationKind,
) -> Self {
Self {
first_revision,
last_revision,
kind,
}
}
pub fn revision_range(&self) -> OperationRevisionRange {
OperationRevisionRange::new(self.first_revision, self.last_revision)
}
}