use anyhow::Error; use collab::entity::EncodedCollab; pub use collab_document::blocks::DocumentData; use flowy_error::FlowyError; use lib_infra::async_trait::async_trait; /// A trait for document cloud service. /// Each kind of server should implement this trait. Check out the [AppFlowyServerProvider] of /// [flowy-server] crate for more information. #[async_trait] pub trait DocumentCloudService: Send + Sync + 'static { async fn get_document_doc_state( &self, document_id: &str, workspace_id: &str, ) -> Result, FlowyError>; async fn get_document_snapshots( &self, document_id: &str, limit: usize, workspace_id: &str, ) -> Result, Error>; async fn get_document_data( &self, document_id: &str, workspace_id: &str, ) -> Result, Error>; async fn create_document_collab( &self, workspace_id: &str, document_id: &str, encoded_collab: EncodedCollab, ) -> Result<(), Error>; } pub struct DocumentSnapshot { pub snapshot_id: i64, pub document_id: String, pub data: Vec, pub created_at: i64, }