2023-07-29 01:46:24 +00:00
|
|
|
use std::collections::HashMap;
|
|
|
|
|
2023-08-17 15:46:39 +00:00
|
|
|
use anyhow::Error;
|
2023-12-29 05:02:27 +00:00
|
|
|
use collab::core::collab::CollabDocState;
|
2023-10-10 11:05:55 +00:00
|
|
|
use collab_entity::CollabType;
|
2023-07-29 01:46:24 +00:00
|
|
|
|
|
|
|
use lib_infra::future::FutureResult;
|
|
|
|
|
2023-12-29 05:02:27 +00:00
|
|
|
pub type CollabDocStateByOid = HashMap<String, CollabDocState>;
|
2023-07-29 01:46:24 +00:00
|
|
|
|
|
|
|
/// 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 {
|
2024-02-03 21:49:45 +00:00
|
|
|
fn get_database_object_doc_state(
|
2023-07-29 01:46:24 +00:00
|
|
|
&self,
|
|
|
|
object_id: &str,
|
2023-10-02 09:22:22 +00:00
|
|
|
collab_type: CollabType,
|
2023-10-23 03:43:31 +00:00
|
|
|
workspace_id: &str,
|
2023-12-29 05:02:27 +00:00
|
|
|
) -> FutureResult<CollabDocState, Error>;
|
2023-07-29 01:46:24 +00:00
|
|
|
|
2024-02-03 21:49:45 +00:00
|
|
|
fn batch_get_database_object_doc_state(
|
2023-07-29 01:46:24 +00:00
|
|
|
&self,
|
|
|
|
object_ids: Vec<String>,
|
|
|
|
object_ty: CollabType,
|
2023-10-23 03:43:31 +00:00
|
|
|
workspace_id: &str,
|
2023-12-29 05:02:27 +00:00
|
|
|
) -> FutureResult<CollabDocStateByOid, Error>;
|
2023-07-29 01:46:24 +00:00
|
|
|
|
2024-02-03 21:49:45 +00:00
|
|
|
fn get_database_collab_object_snapshots(
|
2023-07-29 01:46:24 +00:00
|
|
|
&self,
|
|
|
|
object_id: &str,
|
2023-08-17 15:46:39 +00:00
|
|
|
limit: usize,
|
|
|
|
) -> FutureResult<Vec<DatabaseSnapshot>, Error>;
|
2023-07-29 01:46:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct DatabaseSnapshot {
|
|
|
|
pub snapshot_id: i64,
|
|
|
|
pub database_id: String,
|
|
|
|
pub data: Vec<u8>,
|
|
|
|
pub created_at: i64,
|
|
|
|
}
|