2023-05-21 10:53:59 +00:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
2023-08-12 09:36:31 +00:00
|
|
|
use collab_plugins::cloud_storage::{CollabObject, RemoteCollabStorage};
|
2023-07-05 12:57:09 +00:00
|
|
|
|
2023-07-29 01:46:24 +00:00
|
|
|
use flowy_database_deps::cloud::DatabaseCloudService;
|
|
|
|
use flowy_document_deps::cloud::DocumentCloudService;
|
|
|
|
use flowy_folder_deps::cloud::FolderCloudService;
|
2023-08-24 06:00:34 +00:00
|
|
|
use flowy_user_deps::cloud::UserCloudService;
|
2023-05-21 10:53:59 +00:00
|
|
|
|
|
|
|
use crate::self_host::configuration::SelfHostedConfiguration;
|
2023-05-23 15:55:21 +00:00
|
|
|
use crate::self_host::impls::{
|
2023-07-05 12:57:09 +00:00
|
|
|
SelfHostedDatabaseCloudServiceImpl, SelfHostedDocumentCloudServiceImpl,
|
2023-05-23 15:55:21 +00:00
|
|
|
SelfHostedServerFolderCloudServiceImpl, SelfHostedUserAuthServiceImpl,
|
|
|
|
};
|
2023-05-21 10:53:59 +00:00
|
|
|
use crate::AppFlowyServer;
|
|
|
|
|
|
|
|
pub struct SelfHostServer {
|
|
|
|
pub(crate) config: SelfHostedConfiguration,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl SelfHostServer {
|
|
|
|
pub fn new(config: SelfHostedConfiguration) -> Self {
|
|
|
|
Self { config }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AppFlowyServer for SelfHostServer {
|
2023-08-24 06:00:34 +00:00
|
|
|
fn user_service(&self) -> Arc<dyn UserCloudService> {
|
2023-05-21 10:53:59 +00:00
|
|
|
Arc::new(SelfHostedUserAuthServiceImpl::new(self.config.clone()))
|
|
|
|
}
|
2023-05-23 15:55:21 +00:00
|
|
|
|
|
|
|
fn folder_service(&self) -> Arc<dyn FolderCloudService> {
|
|
|
|
Arc::new(SelfHostedServerFolderCloudServiceImpl())
|
|
|
|
}
|
2023-07-05 12:57:09 +00:00
|
|
|
|
|
|
|
fn database_service(&self) -> Arc<dyn DatabaseCloudService> {
|
|
|
|
Arc::new(SelfHostedDatabaseCloudServiceImpl())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn document_service(&self) -> Arc<dyn DocumentCloudService> {
|
|
|
|
Arc::new(SelfHostedDocumentCloudServiceImpl())
|
|
|
|
}
|
|
|
|
|
2023-08-12 09:36:31 +00:00
|
|
|
fn collab_storage(&self, _collab_object: &CollabObject) -> Option<Arc<dyn RemoteCollabStorage>> {
|
2023-07-05 12:57:09 +00:00
|
|
|
None
|
|
|
|
}
|
2023-05-21 10:53:59 +00:00
|
|
|
}
|