Appearance
Config keys
Version: 2.0
Date: 2026-11-26
Status: Working baseline (PROPOSED keys/defaults; cover + lock + orchestrator CONFIRMED intent; DEC-019/020)
Code: tên key catalog mirror trong src/constants/config-keys.ts (named export, vd. TEMP_TTL, LIFECYCLE_MIGRATE_ENABLED) — seed + runtime import từ đó; SoT ý nghĩa/default vẫn là tài liệu này.
Naming: . = nhóm/lồng; _ = nhiều từ trong một segment. Tiering local↔cloud dưới lifecycle.* (chuẩn ILM). Schedule = *.schedule (không dùng suffix _cron). Cache catalog = config.cache_ttl (không dưới jobs.*).
Duration parse vercel/ms. Child jobs: node-cron UTC trên minap-file-worker, đăng ký bởi jobs orchestrator (DEC-012/016/017) — không hard-code schedule lúc process start.
temp.*
| key | Ý nghĩa | Ví dụ |
|---|---|---|
| temp.ttl | TTL temp | 30m |
| temp.cleanup.batch_size | Max temp rows / GC tick | 100 |
| temp.cleanup.schedule | Lịch GC temp (UTC) | */10 * * * * |
| temp.ext_allowlist | Ext cho phép | MVP: ["png","jpg","jpeg","webp","gif","mp4","webm","mov","pdf","doc","docx","xls","xlsx","ppt","pptx"] — Owner 2026-11-22 |
| temp.max_size_bytes | Max size upload tạm | MVP: 30 MiB global (Owner 2026-11-22); per-purpose = OPEN |
video.cover.* (DEC-014 / Q-BR-057 — CONFIRMED)
| key | Ý nghĩa | Ví dụ |
|---|---|---|
| video.cover.max_attempts | Số lần thử ffmpeg lấy cover lúc promote | 3 |
| video.cover.seek_candidates | Mốc seek (giây); mỗi attempt random một giá trị | [1,5,10] |
Hết max_attempts mà vẫn fail → promote vẫn thành công, cover_storage_name = null.
variant.*
| key | Ý nghĩa | Ví dụ |
|---|---|---|
| variant.ttl | TTL cache WebP | 7d |
| variant.cleanup.batch_size | Max variant rows / GC tick | 100 |
| variant.cleanup.schedule | Lịch GC variant (UTC) | 0 */6 * * * |
| variant.sizes | Allowlist width px | [96,128,192,256,384,512,768,1024] |
lifecycle.* (tiering — DEC-018/019/020)
Policy + engine migrate/purge (không còn prefix local.* / migration.* cho catalog keys). Bảng DB migration_jobs giữ tên entity.
| key | Ý nghĩa | Ví dụ |
|---|---|---|
| lifecycle.retain | Cửa sổ giữ local trước migrate — due = files.created_at + retain (DEC-019) | 3d |
| lifecycle.pin_purposes | Purpose không migrate | ["account_avatar"] — default OPEN |
| lifecycle.migrate.enabled | Bật PutObject migrate; false → tick no-op (DEC-019) | false |
| lifecycle.migrate.schedule | Lịch migrate UTC (vẫn fire khi enabled=false nhưng body skip) | */15 15-21 * * * |
| lifecycle.migrate.batch_size | Max file/batch | 100 |
| lifecycle.migrate.max_attempts | Retry/file | 5 |
| lifecycle.migrate.retry_delay | Chờ retry | 5s |
| lifecycle.migrate.tick_max_ms | Time-box một migrate tick | 25m |
| lifecycle.migrate.verify_checksum | Sau Put: GetObject+SHA-256 so DB; false → tin Put OK (DEC-020) | false |
| lifecycle.purge.schedule | Lịch purge local UTC | 0 * * * * |
| lifecycle.purge.batch_size | Max file / purge tick | 100 |
Parallel Put trong tick: storage_connections.max_concurrent_sync (fallback 4 nếu null).
jobs.orchestrator.* (DEC-017)
| key | Ý nghĩa | Ví dụ value |
|---|---|---|
| jobs.orchestrator.reload_interval | Chu kỳ poll config → diff → re-register children | 30s / 1m |
| jobs.orchestrator.watched_key_prefixes | Prefix theo dõi (JSON) | ["temp.","video.cover.","variant.","lifecycle.","jobs.orchestrator.","jobs.lock.","config."] |
Phát hiện đổi (Q-BR-064): poll theo reload_interval + ops reload now (POST /v1/ops/jobs/reload).
jobs.lock.* (DEC-016)
| key | Ý nghĩa | Ví dụ value |
|---|---|---|
| jobs.lock.temp_cleanup.key | Redis lock — GC temp | fs:lock:temp_cleanup |
| jobs.lock.temp_cleanup.ttl | TTL lock GC temp | 5m |
| jobs.lock.migrate.key | Redis lock — migrate | fs:lock:migrate |
| jobs.lock.migrate.ttl | TTL lock migrate | 30m |
| jobs.lock.purge.key | Redis lock — purge | fs:lock:purge |
| jobs.lock.purge.ttl | TTL lock purge | 15m |
| jobs.lock.variant_cleanup.key | Redis lock — GC variant | fs:lock:variant_cleanup |
| jobs.lock.variant_cleanup.ttl | TTL lock GC variant | 10m |
Không lấy được lock → skip tick.
config.*
| key | Ý nghĩa | Ví dụ |
|---|---|---|
| config.cache_ttl | TTL Redis catalog cache fs:config:catalog | 5m |
Clear cache: POST /v1/ops/config/cache/clear (ops credential).
Child schedules (orchestrator)
| Child | Schedule key |
|---|---|
| Temp GC | temp.cleanup.schedule |
| Migrate | lifecycle.migrate.schedule |
| Purge | lifecycle.purge.schedule |
| Variant GC | variant.cleanup.schedule |
Default cụ thể nhiều key khác = OPEN — xem OPEN catalog.
Runtime: ops/04-runtime-topology.