perf: fix issues #1,#2,#3,#13 from performance audit
- #1 image_transcode: dedicated rayon pool + moka cache (no tokio blocking) - #2 ltree materialized paths: eliminate N+1 folder/file queries - #3 compute_content_hash: read blob_hash column instead of loading file into RAM - #13 event delegation + DocumentFragment: ~15 delegated listeners replace ~19k per-item listeners Backend: 82/82 tests pass, cargo check clean. Frontend: ui.js and app.js syntax-validated via Node.js.
This commit is contained in:
@@ -159,9 +159,6 @@ pub trait DedupPort: Send + Sync + 'static {
|
||||
/// Returns `true` if the blob was deleted (ref_count reached 0).
|
||||
async fn remove_reference(&self, hash: &str) -> Result<bool, DomainError>;
|
||||
|
||||
/// Calculate SHA-256 hash of in-memory content.
|
||||
fn hash_bytes(&self, content: &[u8]) -> String;
|
||||
|
||||
/// Calculate SHA-256 hash of a file (streaming).
|
||||
async fn hash_file(&self, path: &Path) -> Result<String, DomainError>;
|
||||
|
||||
|
||||
@@ -57,6 +57,12 @@ pub trait FileReadPort: Send + Sync + 'static {
|
||||
/// Gets the parent folder ID from a path (WebDAV).
|
||||
async fn get_parent_folder_id(&self, path: &str) -> Result<String, DomainError>;
|
||||
|
||||
/// Gets the content-addressable blob hash for a file (O(1) DB lookup).
|
||||
///
|
||||
/// Returns the SHA-256 hash stored in `storage.files.blob_hash`.
|
||||
/// Used for dedup reference tracking without loading file content.
|
||||
async fn get_blob_hash(&self, file_id: &str) -> Result<String, DomainError>;
|
||||
|
||||
/// Find a file by its logical path (folder_name/.../file_name).
|
||||
///
|
||||
/// The default implementation falls back to `list_files(None)` + linear
|
||||
|
||||
Reference in New Issue
Block a user