remote

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package remote is a pure-Go backend.Backend that drives a spawned helper over the control protocol instead of touching a hypervisor directly. It is the client half of the ADR-0020 inversion: the orchestrator links THIS backend, so its import graph carries no vz/cloud-hypervisor (the macOS sever, now uniform); the real backend lives in the helper, reached by RPC.

The mapping to the wire protocol:

  • CreateNetwork -> createnetwork RPC (returns the subnet)
  • Network.Reserve-> reserve RPC (returns the member's {ip, mac})
  • Create -> stash the resolved spec (no RPC yet)
  • VM.Start -> boot-member RPC (the helper does backend.Create+Start)
  • VM.WaitForIP -> poll the per-member status until running with an IP
  • VM.Stop -> stop RPC

Cluster-level RPCs (createnetwork/reserve/boot-member) travel over the primary member's socket; per-member status/stop travel over the target's own socket. NestedVirtSupported/SupportsClustering are NOT routed here — the client answers host capability with a pure-Go heuristic before any spawn (ADR-0017, R7), so the orchestrator never consults them on this backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

Backend translates backend.Backend calls into control-protocol RPCs against a helper the caller has already spawned. primary is the member whose socket carries the cluster-level RPCs (it always exists for the cluster's lifetime).

func New

func New(st *store.Store, primary string) *Backend

New creates a remote-proxy backend that drives the helper serving `primary` over the store's sockets.

func (*Backend) Create

func (b *Backend) Create(cfg backend.Config, _ backend.Network) (backend.VM, error)

Create stashes the resolved spec and returns a VM handle; the boot-member RPC that actually creates and starts the guest is sent by VM.Start, matching the orchestrator's Create-then-Start order while keeping the helper's create+start atomic.

func (*Backend) CreateNetwork

func (b *Backend) CreateNetwork() (backend.Network, error)

CreateNetwork asks the helper to create the cluster's shared network and returns a Network carrying the reported subnet (empty on the DHCP/vz path).

func (*Backend) NestedVirtSupported

func (b *Backend) NestedVirtSupported() bool

NestedVirtSupported satisfies the interface but is never consulted on the remote backend — the client decides host capability without the helper (R7).

func (*Backend) Reconcile

func (b *Backend) Reconcile() error

Reconcile is a no-op here: prune drives a dedicated short-lived reconcile helper, not the remote proxy (ADR-0013/0020).

func (*Backend) SupportsClustering

func (b *Backend) SupportsClustering() bool

SupportsClustering satisfies the interface but is never consulted on the remote backend — the root package's pure-Go host gate decides it before any spawn.

type Network

type Network struct {
	// contains filtered or unexported fields
}

Network is a handle to the helper's shared cluster network.

func (*Network) Close

func (n *Network) Close() error

Close is a no-op: the helper owns the live network and tears it down on its own teardown (death-watch or last member stopped). The client has no close RPC — closing the network from under live siblings would be a bug (mirrors vz GC).

func (*Network) Reserve

func (n *Network) Reserve(name, ipHint string) (ip, mac string, err error)

Reserve asks the helper to allocate the member's address on the live network and returns the {ip, mac} the client bakes into the seed (Decisions 5, 6).

func (*Network) Subnet

func (n *Network) Subnet() string

Subnet returns the helper-reported CIDR (empty on the DHCP/vz path).

type VM

type VM struct {
	// contains filtered or unexported fields
}

VM is a handle to one member booted by the helper.

func (*VM) Start

func (v *VM) Start(_ context.Context) error

Start sends the boot-member RPC; the helper creates and starts the guest on the shared network using the address it reserved for this member, then replies. The member's runtime IP (vz DHCP) is discovered helper-side and surfaced by status, so callers follow Start with WaitForIP.

func (*VM) State

func (v *VM) State() backend.State

State reports the member's state from the helper, mapped onto backend.State. A missing/unreachable holder reads as stopped.

func (*VM) Stop

func (v *VM) Stop(_ context.Context) error

Stop sends the stop RPC and waits for the member to retire (control.Stop polls its pidfile).

func (*VM) Wait

func (v *VM) Wait(ctx context.Context) error

Wait blocks until the member is no longer running (stopped or errored) or ctx is done, by polling status.

func (*VM) WaitForIP

func (v *VM) WaitForIP(ctx context.Context) (string, error)

WaitForIP polls the member's status until it is running with an IP (the helper discovers a vz VM's DHCP address post-boot and reports it; a cloud-hypervisor VM reports its static address once reachable). It surfaces a helper-side boot error as soon as status reports it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL