ЛР 5: асинхронная обработка изображений и идемпотентность pipeline

This commit is contained in:
R0flyan
2026-11-06 17:56:33 +03:00
parent 276dbdad8a
commit 05641f0bf4
48 changed files with 3554 additions and 41 deletions
+27
View File
@@ -0,0 +1,27 @@
package main
import (
"encoding/json"
"fmt"
"os"
"strconv"
"strings"
)
// Local operator command, never an HTTP endpoint. cgroup v2 records peaks
// between Docker samples too; the experiment recreates API cgroups per case.
func memorySnapshot() error {
result := map[string]uint64{}
for _, name := range []string{"memory.current", "memory.peak"} {
raw, err := os.ReadFile("/sys/fs/cgroup/" + name)
if err != nil {
return fmt.Errorf("cgroup v2 %s unavailable", name)
}
value, err := strconv.ParseUint(strings.TrimSpace(string(raw)), 10, 64)
if err != nil {
return fmt.Errorf("invalid cgroup %s", name)
}
result[name] = value
}
return json.NewEncoder(os.Stdout).Encode(result)
}