internal/pkg: expose snapshot of binfmt entries
All checks were successful
Test / Create distribution (push) Successful in 1m30s
Test / Sandbox (push) Successful in 2m54s
Test / Hakurei (push) Successful in 4m4s
Test / ShareFS (push) Successful in 4m4s
Test / Hakurei (race detector) (push) Successful in 6m46s
Test / Sandbox (race detector) (push) Successful in 8m30s
Test / Flake checks (push) Successful in 3m6s

This is otherwise not externally accessible. The resulting map can be safely mutated.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-06-02 16:05:09 +09:00
parent 56937ac396
commit 9e824452bd

View File

@@ -6,6 +6,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"maps"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
@@ -122,6 +123,15 @@ func RegisterArch(arch string, e container.BinfmtEntry) {
binfmt[arch] = e binfmt[arch] = e
} }
// Arch returns a snapshot of currently registered [KindExec] and [KindExecNet]
// binfmt entries.
func Arch() map[string]container.BinfmtEntry {
binfmtMu.RLock()
r := maps.Clone(binfmt)
binfmtMu.RUnlock()
return r
}
const ( const (
// ExecTimeoutDefault replaces out of range [NewExec] timeout values. // ExecTimeoutDefault replaces out of range [NewExec] timeout values.
ExecTimeoutDefault = 15 * time.Minute ExecTimeoutDefault = 15 * time.Minute