perf: Arc<AppState>, streaming PROPFIND, spawn_blocking SHA-256

- Issue #4: Wrap AppState in Arc — eliminates 42 Arc::clone + 16 String::clone per request
- Issue #2: Reject Depth:infinity with 403 + streaming XML with paginated DB queries
- Issue #5: Move chunked upload assembly (SHA-256 hash-on-write) to spawn_blocking
- Remove ~270 lines dead code from di.rs (unused builders, Default impl, stubs)
- Clean up unused tokio imports in chunked_upload_service.rs
This commit is contained in:
Dionisio
2026-02-24 15:11:56 +01:00
parent cace61127f
commit 71c2cb5edb
20 changed files with 511 additions and 625 deletions
@@ -8,6 +8,7 @@ use tracing::{error, info};
use crate::application::dtos::search_dto::SearchCriteriaDto;
use crate::common::di::AppState;
use std::sync::Arc;
/**
* Handler for search operations through the API.
@@ -21,7 +22,7 @@ pub struct SearchHandler;
impl SearchHandler {
/// GET /search — simple query-parameter-based search.
pub async fn search_files_get(
State(state): State<AppState>,
State(state): State<Arc<AppState>>,
Query(params): Query<SearchParams>,
) -> impl IntoResponse {
info!("API: File search with parameters: {:?}", params);
@@ -79,7 +80,7 @@ impl SearchHandler {
/// POST /search/advanced — full criteria in the request body.
pub async fn search_files_post(
State(state): State<AppState>,
State(state): State<Arc<AppState>>,
Json(criteria): Json<SearchCriteriaDto>,
) -> impl IntoResponse {
info!("API: Advanced file search");
@@ -119,7 +120,7 @@ impl SearchHandler {
/// GET /search/suggest — lightweight autocomplete suggestions.
pub async fn suggest_files(
State(state): State<AppState>,
State(state): State<Arc<AppState>>,
Query(params): Query<SuggestParams>,
) -> impl IntoResponse {
info!("API: Search suggestions for {:?}", params.query);
@@ -162,7 +163,7 @@ impl SearchHandler {
}
/// DELETE /search/cache — clears the search results cache.
pub async fn clear_search_cache(State(state): State<AppState>) -> impl IntoResponse {
pub async fn clear_search_cache(State(state): State<Arc<AppState>>) -> impl IntoResponse {
info!("API: Clearing search cache");
let search_service = match &state.applications.search_service {