use serde::{Deserialize, Serialize};
use self::{
issue_operation::IssueOperationData,
snapshot::{history_step::IssueHistoryStep, timeline::IssueTimeline},
};
use crate::replica::entity::{self, Entity, EntityRead, operation::operations::Operations};
pub mod data;
pub mod issue_operation;
pub mod query;
pub mod snapshot;
#[derive(Debug, Serialize, Deserialize)]
pub struct Issue {
operations: Operations<Self>,
create_time: entity::lamport::Time,
edit_time: entity::lamport::Time,
current_head: gix::ObjectId,
}
impl Entity for Issue {
type HistoryStep = IssueHistoryStep;
type OperationData = IssueOperationData;
type Timeline = IssueTimeline;
const FORMAT_VERSION: usize = 4;
const NAMESPACE: &str = "bugs";
const TYPENAME: &str = "Issue";
fn operations(&self) -> &Operations<Self>
where
Self: Sized,
{
&self.operations
}
unsafe fn from_parts(
operations: Operations<Self>,
create_time: entity::lamport::Time,
edit_time: entity::lamport::Time,
current_head: gix::ObjectId,
) -> Self {
Self {
operations,
create_time,
edit_time,
current_head,
}
}
fn create_time(&self) -> &entity::lamport::Time
where
Self: Sized,
{
&self.create_time
}
fn edit_time(&self) -> &entity::lamport::Time
where
Self: Sized,
{
&self.edit_time
}
fn current_head(&self) -> &gix::oid
where
Self: Sized,
{
&self.current_head
}
}
impl EntityRead for Issue {
type CustomReadError = std::convert::Infallible;
}