chore: remove lru (#5008)

* chore: remove lru

* chore: update logs

* chore: clippy
This commit is contained in:
Nathan.fooo
2024-03-30 16:28:24 +08:00
committed by GitHub
parent c2c84a5812
commit adc2ee755e
33 changed files with 384 additions and 317 deletions

View File

@ -205,7 +205,7 @@ impl FolderManager {
workspace_id,
CollabType::Folder,
collab_db,
DocStateSource::FromDocState(vec![]),
DocStateSource::FromDisk,
CollabPersistenceConfig::new()
.enable_snapshot(true)
.snapshot_per_update(50),
@ -782,7 +782,15 @@ impl FolderManager {
},
)?;
send_workspace_setting_notification(workspace_id, self.get_current_view().await);
let view = self.get_current_view().await;
if let Some(view) = &view {
let view_layout: ViewLayout = view.layout.clone().into();
if let Some(handle) = self.operation_handlers.get(&view_layout) {
let _ = handle.open_view(view_id).await;
}
}
send_workspace_setting_notification(workspace_id, view);
Ok(())
}

View File

@ -211,7 +211,6 @@ pub(crate) fn notify_did_update_section_views(workspace_id: &str, folder: &Folde
pub(crate) fn notify_did_update_workspace(workspace_id: &str, folder: &Folder) {
let repeated_view: RepeatedViewPB = get_workspace_public_view_pbs(workspace_id, folder).into();
tracing::trace!("Did update workspace views: {:?}", repeated_view);
send_notification(workspace_id, FolderNotification::DidUpdateWorkspaceViews)
.payload(repeated_view)
.send();

View File

@ -32,6 +32,7 @@ pub trait FolderOperationHandler {
FutureResult::new(async { Ok(()) })
}
fn open_view(&self, view_id: &str) -> FutureResult<(), FlowyError>;
/// Closes the view and releases the resources that this view has in
/// the backend
fn close_view(&self, view_id: &str) -> FutureResult<(), FlowyError>;