use super::model::Action;
use crate::canvas_protocol::SessionInvariant;
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct Delta {
pub(super) session: SessionInvariant,
pub(super) generation: u64,
pub(super) base_revision: u64,
pub(super) action: Action,
}
impl Delta {
#[must_use]
pub const fn new(
session: SessionInvariant,
generation: u64,
base_revision: u64,
action: Action,
) -> Self {
Self {
session,
generation,
base_revision,
action,
}
}
#[must_use]
pub const fn session(&self) -> &SessionInvariant {
&self.session
}
#[must_use]
pub const fn generation(&self) -> u64 {
self.generation
}
#[must_use]
pub const fn base_revision(&self) -> u64 {
self.base_revision
}
#[must_use]
pub const fn action(&self) -> Action {
self.action
}
}
#[derive(Clone, Copy, Debug, Default)]
#[non_exhaustive]
pub struct Statistics {
pub(super) accepted: u64,
pub(super) drained: u64,
pub(super) sampled: u64,
pub(super) prepared: u64,
pub(super) presented: u64,
}
impl Statistics {
#[must_use]
pub const fn accepted(&self) -> u64 {
self.accepted
}
#[must_use]
pub const fn drained(&self) -> u64 {
self.drained
}
#[must_use]
pub const fn sampled(&self) -> u64 {
self.sampled
}
#[must_use]
pub const fn prepared(&self) -> u64 {
self.prepared
}
#[must_use]
pub const fn presented(&self) -> u64 {
self.presented
}
}