coven_database/
operation_models.rs1use super::*;
2
3#[derive(Debug, Clone)]
4pub struct DurableDeviceRegistration {
5 pub device_id: coven_protocol::store_commit::StoreDeviceId,
6 pub registration_hash: ObjectHash,
7 pub registration_bytes: Vec<u8>,
8 pub prepared: PreparedExactObject,
9 pub initial_ack_ref: StoreAckRef,
10 pub initial_ack: ExactProtocolObject<StoreAck>,
11 pub state: LocalDeviceRegistrationState,
12}
13
14pub struct OwnerRecoveryPublication {
18 pub commit: ExactProtocolObject<coven_protocol::store_commit::VerifiedStoreBatchCommit>,
19 pub head: ExactProtocolObject<coven_protocol::store_commit::StoreDeviceHead>,
20 pub history_evidence: coven_protocol::store_commit::RetainedMergeCommitEvidence,
21}
22
23#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
24#[serde(rename_all = "snake_case", deny_unknown_fields)]
25pub enum LocalDeviceRegistrationState {
26 Prepared,
27 RegistrationPublished,
28 RegistrationActivated {
29 authority: coven_protocol::store_commit::StoreDeviceRegistrationActivation,
30 },
31 Created,
32 Activated {
33 authority: coven_protocol::store_commit::StoreDeviceRegistrationActivation,
34 },
35}
36
37pub type PreparedLocalDeviceRegistrationRow =
38 (String, String, Vec<u8>, String, String, Vec<u8>, String);
39pub type LocalDeviceRegistrationJournalRow = (
40 String,
41 String,
42 Vec<u8>,
43 String,
44 String,
45 Vec<u8>,
46 String,
47 String,
48);
49
50impl DurableDeviceRegistration {
51 pub fn is_activated(&self) -> bool {
52 matches!(self.state, LocalDeviceRegistrationState::Activated { .. })
53 }
54}
55
56#[derive(Debug, Clone)]
57pub struct DurableMembershipMutation {
58 pub intent_hash: ObjectHash,
59 pub plan_bytes: Vec<u8>,
60 pub progress_bytes: Vec<u8>,
61}
62
63#[derive(Clone, Copy)]
64pub enum MembershipMutationActivation {
65 WithoutRotation,
66 Rotation { generation: u64 },
67}
68
69pub struct DurableSnapshotPublication {
70 pub reference: StoreSnapshotRef,
71 pub meta: ExactProtocolObject<SnapshotMeta>,
72 pub rollup: ExactProtocolObject<coven_protocol::store_commit::MembershipRollup>,
76 pub image: PreparedProtocolObject<Vec<u8>>,
77 pub blobs: Vec<PreparedSnapshotBlob>,
78}
79
80#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
81#[serde(deny_unknown_fields)]
82pub struct PreparedSnapshotBlob {
83 pub bindings: Vec<RowBlobLocatorBinding>,
84 pub authority: coven_protocol::audience_package::PackageAudience,
85 pub remote: RemoteObjectRecord,
86 pub spool_path: Option<PathBuf>,
87}
88
89#[derive(Debug, Clone)]
90pub struct PublishedStoreSnapshot {
91 pub reference: StoreSnapshotRef,
92 pub successor_slot: coven_protocol::objects::ObjectSlot,
93 pub meta: SnapshotMeta,
94}
95
96pub struct DurableCircleSnapshotPublication {
97 pub reference: coven_protocol::store_commit::CircleSnapshotRef,
98 pub meta: ExactProtocolObject<coven_protocol::store_commit::CircleSnapshotMeta>,
99 pub image: PreparedProtocolObject<Vec<u8>>,
100 pub blobs: Vec<PreparedSnapshotBlob>,
101}
102
103#[derive(Debug, Clone)]
104pub struct PublishedCircleSnapshot {
105 pub reference: coven_protocol::store_commit::CircleSnapshotRef,
106 pub successor_slot: coven_protocol::objects::ObjectSlot,
107 pub cut: coven_protocol::store_commit::CommitFrontier,
108}