syncor_core/transport/
mod.rs1pub mod git;
2
3use crate::error::Result;
4use crate::link::LinkInfo;
5use std::path::Path;
6
7#[derive(Debug, Clone)]
8pub struct RemoteLinkInfo {
9 pub name: String,
10 pub created_at: String,
11}
12
13#[derive(Debug)]
14pub struct ConflictInfo {
15 pub message: String,
16}
17
18#[derive(Debug)]
19pub enum PushResult {
20 Success { revision: String },
21 Conflict { details: ConflictInfo },
22}
23
24#[derive(Debug)]
25pub enum PullResult {
26 Success { revision: String },
27 UpToDate,
28 Conflict { details: ConflictInfo },
29}
30
31pub trait SyncTransport: Send + Sync {
32 fn init_remote(&self, link: &LinkInfo) -> Result<()>;
33 fn push(&self, link: &LinkInfo, store_path: &Path) -> Result<PushResult>;
34 fn pull(&self, link: &LinkInfo, store_path: &Path) -> Result<PullResult>;
35 fn list_remote_links(&self, repo: &str) -> Result<Vec<RemoteLinkInfo>>;
36 fn has_remote_changes(&self, link: &LinkInfo) -> Result<bool>;
37}