Comments help non-Rust users understand what each function, struct, and module does. Covers the core service (18 source files) and all four example projects (can-sync, canfs, filemanager, paste). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
1.0 KiB
Rust
27 lines
1.0 KiB
Rust
pub mod config; // Configuration loading from YAML
|
|
pub mod db; // SQLite database access (CRUD for assets and tags)
|
|
pub mod error; // Centralized error types and HTTP error responses
|
|
pub mod hash; // SHA-256 content hashing
|
|
pub mod models; // Data structures shared across the codebase
|
|
pub mod routes; // HTTP API route handlers
|
|
pub mod storage; // File I/O: reading, writing, and trashing asset files
|
|
pub mod verifier; // Background integrity checker and file-attribute syncer
|
|
pub mod xattr; // OS-level file metadata (xattr on Unix, NTFS ADS on Windows)
|
|
|
|
use std::sync::Arc;
|
|
|
|
use crate::config::Config;
|
|
use crate::db::Db;
|
|
|
|
/// Broadcast channel for notifying sync subscribers about new assets.
|
|
/// Each message is `"hash:timestamp"` (e.g. `"abc123def456:1710000000000"`).
|
|
pub type SyncEventSender = tokio::sync::broadcast::Sender<String>;
|
|
|
|
/// Shared application state passed to every HTTP handler.
|
|
#[derive(Clone)]
|
|
pub struct AppState {
|
|
pub config: Arc<Config>,
|
|
pub db: Db,
|
|
pub sync_events: SyncEventSender,
|
|
}
|