Dionisio
ed433df2af
perf(zip): eliminate N+1 queries with ltree bulk subtree fetch
...
Replace BFS traversal that issued 2 SQL queries per folder (list_files +
list_folders) with 2 total queries using PostgreSQL ltree <@ operator:
1. list_subtree_folders: single GiST-indexed scan for all folders
2. list_files_in_subtree: single GiST-indexed join for all files
Files are grouped by folder_id in a HashMap, then iterated in directory
order (folders pre-sorted by path from SQL).
Changes across 4 architecture layers:
- Domain: FolderRepository::list_subtree_folders (default impl)
- Application ports: FolderUseCase, FileRetrievalUseCase, FileReadPort
- Application services: FolderService, FileRetrievalService passthroughs
- Infrastructure: PG implementations + ZipService rewrite
Query count: O(N) → O(1). Latency for 100-folder tree: ~200 round-trips → 3.
2026-02-24 12:18:38 +01:00
Dionisio
44113eabdc
perf( #12 ): push suggest() filtering + LIMIT to SQL
...
Replace the in-memory approach (list_files → filter in Rust) with
SQL-level ILIKE + relevance ORDER BY + LIMIT.
- Add suggest_files_by_name() to FileReadPort (default impl for stubs)
- Add suggest_folders_by_name() to FolderRepository (default impl)
- Implement efficient SQL in FileBlobReadRepository & FolderDbRepository
with LOWER(name) LIKE pattern, 3-tier relevance sorting, and LIMIT
- Rewrite SearchService::suggest() to call new methods in parallel
Before: 50K files → ~10 MB transferred, 52K string comparisons
After: 50K files → ~20 rows transferred, index-assisted scan
2026-02-23 23:36:38 +01:00
Diocrafts
85908311dc
perf: findings 6.1, 6.2, 2.6 — async Argon2, moka cache, full streaming migration
...
- 6.1: PasswordHasherPort now async_trait with spawn_blocking for Argon2
- 6.2: OIDC pending maps migrated from std::sync::Mutex to moka::sync::Cache with TTL
- 2.6: All file download paths migrated to 64KB streaming (get_file_stream / read_blob_stream)
- WOPI, dedup, batch ZIP, file_retrieval_service consumers migrated
- WebDAV COPY uses zero-copy dedup (copy_file)
- Removed dead code: get_file_content, get_file_mmap, read_blob, read_blob_bytes
from traits, impls, stubs, and mocks (18 files touched)
2026-02-23 00:51:46 +01:00
Diocrafts
b501c4052b
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
2026-02-23 00:17:40 +01:00
Diocrafts
92e0364a60
fix: OOM protection, lock-free thumbnail cache, OIDC JWKS TTL
...
- Streaming WebDAV PUT: body spooled to tempfile with incremental SHA-256,
peak RAM ~64KB regardless of file size (Solution 2)
- RequestBodyLimitLayer (1MB) on CalDAV/CardDAV routers (Solution 3)
- All body::to_bytes(body, usize::MAX) replaced with explicit limits:
PROPFIND/PROPPATCH/LOCK → 1MB, MKCOL → 4KB
- Added AppError::payload_too_large (HTTP 413)
- Added max_upload_size to StorageConfig (default 10GB, env override)
- New streaming update chain: FileWritePort::update_file_content_from_temp
→ FileUploadUseCase::update_file_streaming
- ThumbnailService: migrated from RwLock<LruCache> to moka::future::Cache
with weight-based eviction — eliminates lock contention on read hot-path
- OIDC: discovery + JWKS caches now expire after 1 hour (Cached<T> wrapper)
so IdP key rotation no longer requires server restart
2026-02-22 23:28:03 +01:00
George Wu
46a65c322c
Add database level pagination and filtering for efficiency
2026-02-21 14:50:53 -08:00
Dionisio
b7bd656a43
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.
2026-02-16 13:10:44 +01:00
Dionisio
1ed20f425f
perf: Phase 4+5 optimizations — uploads 10x, downloads 2x, concurrent 2x. moka cache, 512KB buffers, remove sync_all, hash-on-write, preloaded queries, bench.sh v3, gitignore storage/. 500MB upload 12.6s->1.3s (392MB/s). RSS 69-113MB, 0 swap.
2026-02-15 17:56:47 +01:00
Dionisio
fac0b5e77b
fix: critical bugs from deep audit
...
- Fix copy_files() data loss: implement real copy_file across full stack
(FileWritePort, FileManagementUseCase, stubs, service, repository with
atomic CTE + dedup ref_count increment, batch_operations caller)
- Fix plaintext password in replace_default_admin: hash password via
PasswordHasherPort before User::new()
- Fix CalendarService hardcoded user_id: unify CalendarUseCase trait with
explicit user_id parameter on all methods, remove zombie _for_user
duplicates and hardcoded 'current_user_id', update 20 CalDAV handler
call sites
- Previous session: migrate DedupService to PostgreSQL (storage.blobs),
atomic CTEs with compensation for file/folder repository operations
2026-02-14 20:22:19 +01:00
Dionisio
3f60765d9a
fix( #104 ): enforce storage quota on uploads & fix usage tracking
...
Backend:
- Add QuotaExceeded error kind mapped to HTTP 507 Insufficient Storage
- Add check_storage_quota() and get_user_storage_info() to StorageUsagePort
- Enforce quota in upload_file_with_cache, upload_file_with_thumbnails (AuthUser extractor)
- Enforce quota in chunked upload create_upload handler
- Add update_user_storage_usage_by_username() for username-based lookup
- Fix extract_username_from_path() to handle subfolders (take first segment only)
- Fix maybe_update_storage_usage() to use username-based lookup instead of passing
username to get_user_by_id (which always failed silently)
Frontend:
- Parse and display quota error messages on upload failure (507 / QuotaExceeded)
- Stop remaining uploads when quota is exceeded
- Call refreshUserData() after uploads to update storage usage display
- Bump service worker cache to v9
2026-02-14 10:34:07 +01:00
Dionisio
4c98c5a657
style: apply cargo fmt to entire codebase
...
Standardize code formatting across all 173 Rust source files
using rustfmt. No functional changes - purely cosmetic.
This establishes a consistent code style baseline for the
project going forward.
2026-02-14 01:29:34 +01:00
Dionisio
d31a413e57
chore: translate all Spanish comments and log messages to English
2026-02-12 09:41:25 +01:00
Diocrafts
5bd505ccd7
modernizing frontend
2026-02-08 22:44:42 +01:00
Diocrafts
a82faa5eaf
refactoring hexagonal and clean architecture
2026-02-08 13:40:23 +01:00
DioCrafts
52d8250d51
adding card dav and cald dav
2025-04-13 01:04:04 +02:00
DioCrafts
8f1d213526
improve postgresql performance
2025-04-09 00:21:20 +02:00
DioCrafts
6e055c3043
adding features
2025-03-19 19:52:12 +01:00