mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-08-20 23:00:43 +00:00

* chore: revamp error for FolderCloudService service * chore: bump cloud * ci: update configuration * chore: clippy * chore: bump client api
45 lines
1.1 KiB
Rust
45 lines
1.1 KiB
Rust
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<Vec<u8>, FlowyError>;
|
|
|
|
async fn get_document_snapshots(
|
|
&self,
|
|
document_id: &str,
|
|
limit: usize,
|
|
workspace_id: &str,
|
|
) -> Result<Vec<DocumentSnapshot>, FlowyError>;
|
|
|
|
async fn get_document_data(
|
|
&self,
|
|
document_id: &str,
|
|
workspace_id: &str,
|
|
) -> Result<Option<DocumentData>, FlowyError>;
|
|
|
|
async fn create_document_collab(
|
|
&self,
|
|
workspace_id: &str,
|
|
document_id: &str,
|
|
encoded_collab: EncodedCollab,
|
|
) -> Result<(), FlowyError>;
|
|
}
|
|
|
|
pub struct DocumentSnapshot {
|
|
pub snapshot_id: i64,
|
|
pub document_id: String,
|
|
pub data: Vec<u8>,
|
|
pub created_at: i64,
|
|
}
|