Реализовать уровень 4 и упорядочить структуру backend

Добавить crop и WebP, изолированную обработку с таймаутом, lease token, backoff с jitter, реестр failed, безопасный replay и очистку staging. Добавить проверки crash-окон и восстановления. Разделить запуск API, CLI-команды, фоновые процессы и инфраструктуру по пакетам.
This commit is contained in:
Dima
2026-11-04 20:14:49 +03:00
parent 495ad58cb7
commit 4bee6a5d4a
26 changed files with 1478 additions and 484 deletions
+29
View File
@@ -0,0 +1,29 @@
package faults
import (
"log"
"os"
"path/filepath"
"github.com/google/uuid"
)
// Only an operator-mounted directory enables faults; clients cannot set them.
// Rename makes each injected crash one-shot across automatic container restarts.
func Take(point, id string) bool {
directory := os.Getenv("PIPELINE_FAULT_DIR")
if directory == "" {
return false
}
if _, err := uuid.Parse(id); err != nil {
return false
}
name := filepath.Join(directory, point+"."+id)
return os.Rename(name, name+".hit") == nil
}
func Crash(point, id string) {
if Take(point, id) {
log.Printf("injected pipeline crash: %s, attachment %s", point, id)
os.Exit(86)
}
}