banger/internal/daemon
Thales Maciel c0d456e734
daemon split (3/5): extract *WorkspaceService service
Third phase of splitting the daemon god-struct. WorkspaceService now
owns workspace.prepare / workspace.export plus the ssh-key +
git-identity + arbitrary-file sync that runs as part of VM start's
prepare_work_disk capability hook. workspaceLocks (the per-VM tar
serialisation set) lives on the service.

workspace.go and vm_authsync.go flipped receivers from *Daemon to
*WorkspaceService. The workspaceInspectRepo / workspaceImport test
seams moved onto the service as fields.

Peer-service dependencies go through narrow function-typed fields:
vmResolver, aliveChecker, waitGuestSSH, dialGuest, imageResolver,
imageWorkSeed, withVMLockByRef, beginOperation. WorkspaceService
never touches VMService / HostNetwork / ImageService directly —
only the exact operations the Daemon hands it at construction.

Daemon lazy-init helper workspaceSvc() mirrors the Phase 1/2
pattern. Test literals still write `&Daemon{store: db, runner: r}`
and get a wired workspace service for free. Tests that override the
inspect/import seams (workspace_test.go, ~4 sites) assign them on
d.workspaceSvc() instead of on the daemon literal.

Dispatch in daemon.go: vm.workspace.prepare and vm.workspace.export
now forward one-liners to d.workspaceSvc().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 20:42:31 -03:00
..
dmsnap Extract opstate and dmsnap into subpackages 2026-04-15 16:02:43 -03:00
fcproc runtime sockets: close the local-user race window around control-plane creation 2026-04-20 12:53:47 -03:00
imagemgr Remove image build --from-image; doctor treats catalog images as OK 2026-04-18 15:54:29 -03:00
opstate coverage: medium batch — hostnat runner, store guest-sessions, daemon helpers 2026-04-18 18:03:37 -03:00
workspace remove vm session feature 2026-04-20 12:47:58 -03:00
ARCHITECTURE.md daemon: shrink createVMMu + imageOpsMu to reservation/publication windows 2026-04-20 13:44:22 -03:00
autopull_test.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
capabilities.go daemon split (3/5): extract *WorkspaceService service 2026-04-20 20:42:31 -03:00
capabilities_test.go Remove opencode package + vm acp command (dead code) 2026-04-18 16:54:37 -03:00
concurrency_test.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
daemon.go daemon split (3/5): extract *WorkspaceService service 2026-04-20 20:42:31 -03:00
daemon_test.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
dns_routing.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
dns_routing_test.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
doc.go daemon: correct ARCHITECTURE doc to match actual package shape + lock scope 2026-04-20 13:02:36 -03:00
doctor.go ssh-config: make the ssh <name>.vm shortcut opt-in 2026-04-20 13:57:26 -03:00
fake_firecracker_test.go remove vm session feature 2026-04-20 12:47:58 -03:00
fastpath_test.go daemon split (3/5): extract *WorkspaceService service 2026-04-20 20:42:31 -03:00
guest_ssh.go remove vm session feature 2026-04-20 12:47:58 -03:00
host_network.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
image_seed.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
image_service.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
images.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
images_helpers_test.go coverage: medium batch — hostnat runner, store guest-sessions, daemon helpers 2026-04-18 18:03:37 -03:00
images_pull.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
images_pull_bundle_test.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
images_pull_test.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
kernels.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
kernels_test.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
logger.go vm state: split transient kernel/process handles off the durable schema 2026-04-19 14:18:13 -03:00
logger_test.go Remove image build --from-image; doctor treats catalog images as OK 2026-04-18 15:54:29 -03:00
nat.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
nat_test.go vm state: split transient kernel/process handles off the durable schema 2026-04-19 14:18:13 -03:00
open_close_test.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
ports.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
preflight.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
runtime_assets.go Remove runtime-bundle image dependencies 2026-03-21 18:34:53 -03:00
snapshot.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
snapshot_test.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
ssh_client_config.go ssh-config: make the ssh <name>.vm shortcut opt-in 2026-04-20 13:57:26 -03:00
ssh_client_config_test.go ssh-config: make the ssh <name>.vm shortcut opt-in 2026-04-20 13:57:26 -03:00
sshd_config_test.go guest sshd: drop DEBUG3 + StrictModes no; normalise /root perms 2026-04-19 13:40:40 -03:00
tap_pool.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
vm.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
vm_authsync.go daemon split (3/5): extract *WorkspaceService service 2026-04-20 20:42:31 -03:00
vm_create.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
vm_create_ops.go Add lint targets, fix gofmt drift, broaden Makefile build inputs 2026-04-16 16:49:17 -03:00
vm_create_test.go daemon: use exact-name lookup for VM-create uniqueness 2026-04-20 14:00:33 -03:00
vm_disk.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
vm_handles.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
vm_handles_test.go vm state: split transient kernel/process handles off the durable schema 2026-04-19 14:18:13 -03:00
vm_lifecycle.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
vm_locks.go Move subsystem state/locks off Daemon into owning types 2026-04-15 15:58:33 -03:00
vm_set.go vm state: split transient kernel/process handles off the durable schema 2026-04-19 14:18:13 -03:00
vm_stats.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
vm_test.go daemon split (3/5): extract *WorkspaceService service 2026-04-20 20:42:31 -03:00
workspace.go daemon split (3/5): extract *WorkspaceService service 2026-04-20 20:42:31 -03:00
workspace_service.go daemon split (3/5): extract *WorkspaceService service 2026-04-20 20:42:31 -03:00
workspace_test.go daemon split (3/5): extract *WorkspaceService service 2026-04-20 20:42:31 -03:00