pinakes/crates/pinakes-server/src/state.rs
NotAShelf 52f0b5defc
pinakes-server: wire backup, session refresh, webhooks, and rate limit config
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: If2855d44cc700c0f65a5f5ac850ee3866a6a6964
2026-03-08 00:43:26 +03:00

40 lines
1.4 KiB
Rust

use std::{path::PathBuf, sync::Arc};
use pinakes_core::{
cache::CacheLayer,
config::Config,
jobs::JobQueue,
managed_storage::ManagedStorageService,
plugin::PluginManager,
scan::ScanProgress,
scheduler::TaskScheduler,
storage::DynStorageBackend,
sync::ChunkedUploadManager,
transcode::TranscodeService,
webhooks::WebhookDispatcher,
};
use tokio::sync::{RwLock, Semaphore};
// Note: Sessions are now stored in the database via StorageBackend
// See storage::SessionData and related methods
/// Max concurrent background session operations (touch/delete).
/// Prevents unbounded task spawning under high request load.
pub const MAX_SESSION_BACKGROUND_TASKS: usize = 64;
#[derive(Clone)]
pub struct AppState {
pub storage: DynStorageBackend,
pub config: Arc<RwLock<Config>>,
pub config_path: Option<PathBuf>,
pub scan_progress: ScanProgress,
pub job_queue: Arc<JobQueue>,
pub cache: Arc<CacheLayer>,
pub scheduler: Arc<TaskScheduler>,
pub plugin_manager: Option<Arc<PluginManager>>,
pub transcode_service: Option<Arc<TranscodeService>>,
pub managed_storage: Option<Arc<ManagedStorageService>>,
pub chunked_upload_manager: Option<Arc<ChunkedUploadManager>>,
pub webhook_dispatcher: Option<Arc<WebhookDispatcher>>,
pub session_semaphore: Arc<Semaphore>,
}