diff --git a/packages/turso-sync/src/sync_server/mod.rs b/packages/turso-sync/src/sync_server/mod.rs new file mode 100644 index 000000000..f9e9e8db1 --- /dev/null +++ b/packages/turso-sync/src/sync_server/mod.rs @@ -0,0 +1,46 @@ +use crate::Result; + +#[cfg(test)] +pub mod test; +pub mod turso; + +#[derive(Debug, serde::Deserialize)] +pub struct DbSyncInfo { + pub current_generation: usize, +} + +#[derive(Debug, serde::Deserialize)] +pub struct DbSyncStatus { + pub baton: Option, + pub status: String, + pub generation: usize, + pub max_frame_no: usize, +} + +pub trait Stream { + fn read_chunk( + &mut self, + ) -> impl std::future::Future>> + Send; +} + +pub trait SyncServer { + type Stream: Stream; + fn db_info(&self) -> impl std::future::Future> + Send; + fn db_export( + &self, + generation_id: usize, + ) -> impl std::future::Future> + Send; + fn wal_pull( + &self, + generation_id: usize, + start_frame: usize, + ) -> impl std::future::Future> + Send; + fn wal_push( + &self, + baton: Option, + generation_id: usize, + start_frame: usize, + end_frame: usize, + frames: Vec, + ) -> impl std::future::Future> + Send; +}