872ffcaf25
P07a/b/c — Runtime abstraction interface + 5 implementations.
Runtime interface (internal/runtime/runtime.go, REQ-078):
- Runtime interface { Prepare, Start, Stop, Status }. Alloc struct carries
Runtime field (changeable on migration per R-004). Registry keyed by
runtime.one_of. DefaultRegistry(transport) registers all 5.
Process (internal/runtime/process.go):
- ProcessRuntime wraps os/exec (LOCAL testing only; production uses systemd
emitter). SIGTERM grace 10s then SIGKILL.
Podman (internal/runtime/podman.go):
- PodmanRuntime via sshpush.Transport. podman pull/run/stop/rm/inspect.
Wasm (internal/runtime/wasm.go, gate C-01 SATISFIED):
- WasmRuntime uses wasmtime CLI (apt-installed on peer) via SSH exec. NO CGO
— does NOT import bytecodealliance/wasmtime-go. CGO_ENABLED=0 build
passes. D-002 cross-compile story preserved. D-187 recorded.
PVE (internal/runtime/pve.go):
- PveVMRuntime (qm create/start/stop/status) + PveCTRuntime (pct
create/start/stop/status) via sshpush.Transport. VMID = hash(alloc.ID)%99999.
C-01 evaluation: internal/runtime/C01_WASMTIME_CGO_EVAL.md. Auto-decision
(full autonomy): wasmtime remains primary; CLI-via-SSH avoids CGO entirely.
D-187 in PROJECT.md.
23 packages pass, 20 bats pass, gofmt clean, verify-reqs 90 consistent.
92.7% coverage on internal/runtime.
---ci---
project: orca
phase: P07a/b/c
milestone: v0.9
status: execute
---/ci---
21 lines
743 B
Go
21 lines
743 B
Go
package runtime
|
|
|
|
import (
|
|
"git.cloudinit.dev/coreci/orca/internal/sshpush"
|
|
)
|
|
|
|
// DefaultRegistry returns a Registry with all five runtime backends
|
|
// registered (process, podman, wasm, pve-vm, pve-ct). The process
|
|
// runtime is transport-less; the others are backed by the given
|
|
// transport (which may be nil — the per-method calls will fail with
|
|
// an sshpush error, but registration still succeeds).
|
|
func DefaultRegistry(transport *sshpush.Transport) *Registry {
|
|
r := NewRegistry()
|
|
r.Register("process", NewProcessRuntime())
|
|
r.Register("podman", NewPodmanRuntime(transport))
|
|
r.Register("wasm", NewWasmRuntime(transport))
|
|
r.Register("pve-vm", NewPveVMRuntime(transport))
|
|
r.Register("pve-ct", NewPveCTRuntime(transport))
|
|
return r
|
|
}
|