Revert "feat: folder search mvp (#4665)" (#4962)

This reverts commit c1006c18c3.
This commit is contained in:
Lucas.Xu
2024-03-22 14:15:38 +07:00
committed by GitHub
parent e2e38f72bb
commit 27ff5f07ab
123 changed files with 519 additions and 4011 deletions

View File

@ -8,29 +8,24 @@ edition = "2021"
[dependencies]
collab = { version = "0.1.0" }
collab-folder = { version = "0.1.0" }
collab-document = { version = "0.1.0" }
collab-entity = { version = "0.1.0" }
collab-plugins = { version = "0.1.0" }
collab-integrate = { workspace = true }
flowy-folder-pub = { workspace = true }
flowy-search-pub = { workspace = true }
flowy-derive.workspace = true
flowy-notification = { workspace = true }
flowy-notification = { workspace = true }
parking_lot.workspace = true
unicode-segmentation = "1.10"
tracing.workspace = true
flowy-error = { path = "../flowy-error", features = [
"impl_from_dispatch_error",
"impl_from_collab_folder",
] }
flowy-error = { path = "../flowy-error", features = ["impl_from_dispatch_error", "impl_from_collab_folder"]}
lib-dispatch = { workspace = true }
bytes.workspace = true
lib-infra = { workspace = true }
tokio = { workspace = true, features = ["sync"] }
nanoid = "0.4.0"
lazy_static = "1.4.0"
chrono = { workspace = true, default-features = false, features = ["clock"] }
chrono = { workspace = true, default-features = false, features = ["clock"] }
strum_macros = "0.21"
protobuf.workspace = true
uuid.workspace = true

View File

@ -9,7 +9,6 @@ use collab_folder::{
Folder, FolderData, FolderNotify, Section, SectionItem, TrashInfo, UserId, View, ViewLayout,
ViewUpdate, Workspace,
};
use flowy_search_pub::entities::FolderIndexManager;
use parking_lot::{Mutex, RwLock};
use tracing::{error, info, instrument};
@ -49,16 +48,12 @@ conditional_send_sync_trait! {
}
pub struct FolderManager {
/// workspace_id represents as the id of the Folder.
pub(crate) workspace_id: RwLock<Option<String>>,
/// MutexFolder is the folder that is used to store the data.
pub(crate) mutex_folder: Arc<MutexFolder>,
pub(crate) collab_builder: Arc<AppFlowyCollabBuilder>,
pub(crate) user: Arc<dyn FolderUser>,
pub(crate) operation_handlers: FolderOperationHandlers,
pub cloud_service: Arc<dyn FolderCloudService>,
pub(crate) folder_indexer: Arc<dyn FolderIndexManager>,
}
impl FolderManager {
@ -67,7 +62,6 @@ impl FolderManager {
collab_builder: Arc<AppFlowyCollabBuilder>,
operation_handlers: FolderOperationHandlers,
cloud_service: Arc<dyn FolderCloudService>,
folder_indexer: Arc<dyn FolderIndexManager>,
) -> FlowyResult<Self> {
let mutex_folder = Arc::new(MutexFolder::default());
let manager = Self {
@ -77,7 +71,6 @@ impl FolderManager {
operation_handlers,
cloud_service,
workspace_id: Default::default(),
folder_indexer,
};
Ok(manager)
@ -145,7 +138,7 @@ impl FolderManager {
if let Some(workspace_id) = workspace_id {
self.get_workspace_views(&workspace_id).await
} else {
tracing::warn!("Can't get the workspace id from the folder. Return empty list.");
tracing::warn!("Can't get current workspace views");
Ok(vec![])
}
}
@ -480,13 +473,6 @@ impl FolderManager {
},
);
if let Ok(workspace_id) = self.get_current_workspace_id().await {
let folder = &self.mutex_folder.lock();
if let Some(folder) = folder.as_ref() {
notify_did_update_workspace(&workspace_id, folder);
}
}
Ok(view)
}
@ -1219,8 +1205,6 @@ pub(crate) fn get_workspace_private_view_pbs(_workspace_id: &str, folder: &Folde
.collect()
}
/// The MutexFolder is a wrapper of the [Folder] that is used to share the folder between different
/// threads.
#[derive(Clone, Default)]
pub struct MutexFolder(Arc<Mutex<Option<Folder>>>);
impl Deref for MutexFolder {

View File

@ -1,14 +1,13 @@
use collab_entity::CollabType;
use collab_folder::{Folder, FolderNotify, UserId};
use tokio::task::spawn_blocking;
use tracing::{event, Level};
use collab_integrate::CollabKVDB;
use flowy_error::{FlowyError, FlowyResult};
use std::sync::{Arc, Weak};
use tracing::{event, Level};
use crate::manager::{FolderInitDataSource, FolderManager};
use crate::manager_observer::{
@ -117,22 +116,6 @@ impl FolderManager {
};
let folder_state_rx = folder.subscribe_sync_state();
let index_content_rx = folder.subscribe_index_content();
self
.folder_indexer
.set_index_content_receiver(index_content_rx);
// Index all views in the folder if needed
if !self.folder_indexer.is_indexed() {
let views = folder.get_all_views_recursively();
let folder_indexer = self.folder_indexer.clone();
// We spawn a blocking task to index all views in the folder
spawn_blocking(move || {
folder_indexer.index_all_views(views);
});
}
*self.mutex_folder.lock() = Some(folder);
let weak_mutex_folder = Arc::downgrade(&self.mutex_folder);