How wxwmoe/mokyu works
Mokyu is a Rust S3-compatible media-storage gateway. S3 clients submit object and multipart operations through the protocol and HTTP layers; the application processes streams into content-defined, deduplicated chunks, then stores encoded data through a local cache and S3-compatible backend while PostgreSQL tracks objects and chunk metadata. Reads resolve stored objects and return data, including range reads. The product also exposes a management UI/API and background integrity, lifecycle, packing, cleanup, and statistics capabilities. Some subsystem links reflect documented capabilities and module roles; unsampled source wiring is not asserted.
Main entry points: app.rs Application core · tasks.rs Task coordinator · http.rs HTTP routing · main.rs Service runtime
Components 25
Interfaces
- Service runtime
src/main.rs - HTTP routing
src/http.rs - S3 protocol
src/s3.rs
Object pipeline
- Application core
src/app.rs - Object uploads
src/upload.rs - Multipart uploads
src/multipart.rs - Chunk codec
src/codec.rs - Compression
src/compression.rs - Range reads
src/range.rs - Object listing
src/listing.rs
Persistence
- Chunk storage
src/storage.rs - S3 backend
src/backend.rs - PostgreSQL
- Database setup
src/db.rs - Configuration
src/config.rs
Background operations
- Task coordinator
src/tasks.rs - Pack maintenance
src/pack_tasks.rs - Integrity checks
src/integrity.rs - Lifecycle cleanup
src/lifecycle.rs - Statistics
src/stats.rs
Management
- Management API
src/admin.rs - Management UI
web/app.js
Other components
- S3 client
- Operator
- Admin browser
Connections 28
- Service runtime → Application core: initializes
- Service runtime → HTTP routing: serves
- Service runtime → Task coordinator: runs
- S3 client → HTTP routing: requests
- HTTP routing → S3 protocol: dispatches
- S3 protocol → Application core: invokes
- S3 protocol → Multipart uploads: invokes
- Application core → Object uploads: processes uploads
- Application core → Chunk codec: encodes chunks
- Application core → Chunk storage: stores and reads
- Application core → PostgreSQL: queries and updates
- Multipart uploads → Application core: publishes objects
- Application core → Range reads: serves ranges
- Application core → Object listing: lists objects
- Chunk storage → S3 backend: reads and writes
- S3 backend → PostgreSQL: uses metadata
- Database setup → PostgreSQL: initializes schema
- Configuration → Application core: configures
- Task coordinator → Pack maintenance: dispatches pack work
- Task coordinator → Integrity checks: dispatches checks
- Task coordinator → Lifecycle cleanup: runs cleanup
- Task coordinator → PostgreSQL: claims task state
- Service runtime → Statistics: runs
- HTTP routing → Management API: serves management
- Operator → Management API: administers
- Admin browser → Management UI: uses
- Management UI → HTTP routing: calls API
- Management API → Task coordinator: requests tasks