perf: replace recursive spawn-per-folder search with O(1) ltree queries
- Add search_files_in_subtree() to FileReadPort with ltree-based SQL - Add list_descendant_folders() to FolderRepository with ltree GiST index - Implement both in PG repositories (single query per entity type) - Remove search_parallel() fan-out (O(N) tokio::spawn → 0 spawns) - Remove passes_file_filter/passes_folder_filter (filtering now in SQL) - Fix SearchCriteriaDto cache key: JSON serialization → u64 hash (15x faster) - Fix escaped quote literals in webdav_handler.rs handle_put function
This commit is contained in:
@@ -103,4 +103,21 @@ pub trait FolderRepository: Send + Sync + 'static {
|
||||
/// Creates a root-level home folder for a user.
|
||||
/// This is used during user registration to create the user's personal folder.
|
||||
async fn create_home_folder(&self, user_id: &str, name: String) -> Result<Folder, DomainError>;
|
||||
|
||||
/// Lists all descendant folders in a subtree (ltree-based).
|
||||
///
|
||||
/// Returns all folders whose lpath is a descendant of the given folder's
|
||||
/// lpath. Used for recursive search — O(1) SQL via GiST index instead
|
||||
/// of O(N) recursive traversal.
|
||||
///
|
||||
/// The default implementation returns an empty vec (stubs / mocks).
|
||||
async fn list_descendant_folders(
|
||||
&self,
|
||||
folder_id: &str,
|
||||
name_contains: Option<&str>,
|
||||
user_id: &str,
|
||||
) -> Result<Vec<Folder>, DomainError> {
|
||||
let _ = (folder_id, name_contains, user_id);
|
||||
Ok(Vec::new())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user