use std::collections::HashMap; use anyhow::Error; use collab::core::collab::CollabDocState; use collab_entity::CollabType; use lib_infra::future::FutureResult; pub type CollabDocStateByOid = HashMap; /// A trait for database cloud service. /// Each kind of server should implement this trait. Check out the [AppFlowyServerProvider] of /// [flowy-server] crate for more information. pub trait DatabaseCloudService: Send + Sync { /// The suffix 'db' in the method name serves as a workaround to avoid naming conflicts with the existing method `get_collab_doc_state`. fn get_collab_doc_state_db( &self, object_id: &str, collab_type: CollabType, workspace_id: &str, ) -> FutureResult; /// The suffix 'db' in the method name serves as a workaround to avoid naming conflicts with the existing method `get_collab_doc_state`. fn batch_get_collab_doc_state_db( &self, object_ids: Vec, object_ty: CollabType, workspace_id: &str, ) -> FutureResult; fn get_collab_snapshots( &self, object_id: &str, limit: usize, ) -> FutureResult, Error>; } pub struct DatabaseSnapshot { pub snapshot_id: i64, pub database_id: String, pub data: Vec, pub created_at: i64, }