aven_core/sync/
persistence.rs1use super::wire::{ChangeWire, PushAck, SyncRequest, SyncResponse};
2
3mod blobs;
4mod changes;
5mod client;
6mod parent_liveness;
7mod server;
8mod status;
9use blobs::{
10 apply_server_blob_reference, collect_attachment_liveness_hashes,
11 ensure_attachment_blobs_admitted, prepare_server_blobs,
12};
13use changes::{
14 epic_change_workspace, insert_wire_change, is_epic_change, load_assigned_change_ids,
15 load_existing_change_ids, reconcile_acknowledged_epic_memberships, reconcile_epic_change,
16 update_change_server_seq, update_change_server_seqs_if_missing, verify_existing_change,
17};
18use server::assign_server_sequences;
19use status::sync_persistence_status;
20
21#[derive(Debug, Clone, Default, PartialEq, Eq)]
22pub struct SyncPersistenceStatus {
23 pub pinned_server: Option<String>,
24 pub established_protocol: u32,
25 pub blocked_protocol: Option<u32>,
26 pub pending_changes: i64,
27 pub pending_attachment_uploads: i64,
28 pub pending_attachment_upload_bytes: i64,
29 pub conflicts: i64,
30 pub sync_cursor: Option<String>,
31 pub local_sequence: Option<String>,
32 pub last_attempt: Option<String>,
33 pub last_success: Option<String>,
34 pub last_error: Option<String>,
35 pub last_pushed: Option<String>,
36 pub last_pulled: Option<String>,
37 pub last_cursor: Option<String>,
38}
39
40#[derive(Debug, Clone)]
41pub struct ClientSyncPage {
42 pub request: SyncRequest,
43 pub pending: usize,
44 pub(crate) behavior_protocol: u32,
45}
46
47#[derive(Debug)]
48pub struct ApplySyncPage {
49 pub request: SyncRequest,
50 pub response: SyncResponse,
51 pub attempted_at: String,
52 pub previous_pushed: i64,
53 pub previous_pulled: usize,
54}
55
56#[derive(Debug)]
57pub struct ServerSyncPage {
58 pub request: SyncRequest,
59}
60
61#[derive(Debug)]
62pub struct ServerSyncResult {
63 pub accepted_count: i64,
64 pub push_acks: Vec<PushAck>,
65 pub changes: Vec<ChangeWire>,
66 pub has_more: bool,
67 pub blob_prepare_ms: u128,
68 pub assign_ms: u128,
69 pub pull_query_ms: u128,
70}