git_bug/entities/issue/
mod.rs1use serde::{Deserialize, Serialize};
19
20use self::{
21 issue_operation::IssueOperationData,
22 snapshot::{history_step::IssueHistoryStep, timeline::IssueTimeline},
23};
24use crate::replica::entity::{self, Entity, EntityRead, operation::operations::Operations};
25
26pub mod data;
27pub mod issue_operation;
28pub mod query;
29pub mod snapshot;
30
31#[derive(Debug, Serialize, Deserialize)]
35pub struct Issue {
36 operations: Operations<Self>,
37 create_time: entity::lamport::Time,
38 edit_time: entity::lamport::Time,
39 current_head: gix::ObjectId,
40}
41
42impl Entity for Issue {
43 type HistoryStep = IssueHistoryStep;
44 type OperationData = IssueOperationData;
45 type Timeline = IssueTimeline;
46
47 const FORMAT_VERSION: usize = 4;
48 const NAMESPACE: &str = "bugs";
49 const TYPENAME: &str = "Issue";
50
51 fn operations(&self) -> &Operations<Self>
52 where
53 Self: Sized,
54 {
55 &self.operations
56 }
57
58 unsafe fn from_parts(
59 operations: Operations<Self>,
60 create_time: entity::lamport::Time,
61 edit_time: entity::lamport::Time,
62 current_head: gix::ObjectId,
63 ) -> Self {
64 Self {
65 operations,
66 create_time,
67 edit_time,
68 current_head,
69 }
70 }
71
72 fn create_time(&self) -> &entity::lamport::Time
73 where
74 Self: Sized,
75 {
76 &self.create_time
77 }
78
79 fn edit_time(&self) -> &entity::lamport::Time
80 where
81 Self: Sized,
82 {
83 &self.edit_time
84 }
85
86 fn current_head(&self) -> &gix::oid
87 where
88 Self: Sized,
89 {
90 &self.current_head
91 }
92}
93
94impl EntityRead for Issue {
95 type CustomReadError = std::convert::Infallible;
98}