dx_forge/sync/
messages.rs1use serde::{Deserialize, Serialize};
2
3use crate::crdt::Operation;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(tag = "type", rename_all = "snake_case")]
8pub enum SyncMessage {
9 Handshake { actor_id: String, repo_id: String },
10 Operation { operation: Operation },
11}
12
13impl SyncMessage {
14 pub fn handshake(actor_id: String, repo_id: String) -> Self {
15 Self::Handshake { actor_id, repo_id }
16 }
17
18 pub fn operation(operation: Operation) -> Self {
19 Self::Operation { operation }
20 }
21}