Help us shape the future of Go! Take the 2026 Go Developer Survey

microvm

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package microvm provides the root module's thin UDS adapter for microvmd. It deliberately duplicates only the versioned JSON wire shapes and does not import the nested runtime module.

Index

Constants

View Source
const (
	// DaemonProtocolVersion is the exact local management protocol spoken by this client.
	DaemonProtocolVersion uint16 = 4
)

Variables

View Source
var (
	ErrRepositoryLogicalRootUnavailable error = repositoryLogicalRootUnavailableError{}
)

ErrRepositoryLogicalRootUnavailable is returned when an authenticated guest cannot attach the prepared repository worktree. It carries no daemon detail.

Functions

This section is empty.

Types

type Client

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

Client speaks the authenticated local management protocol. Authentication is performed by microvmd from kernel peer credentials before it decodes a frame.

func New

func New(endpoint string) (*Client, error)

New validates endpoint and constructs a thin lifecycle client.

func NewPlacementProvider

func NewPlacementProvider(endpoint, sourceCheckout, profile string, scope server.PlacementScope, readiness func(context.Context) error) (*Client, error)

NewPlacementProvider constructs a deployment-owned microVM default placement.

func (*Client) Bind

Bind provisions either the trusted deployment default or explicit no-FS attenuation.

func (*Client) DaemonInfo

func (c *Client) DaemonInfo(ctx context.Context) (DaemonInfo, error)

DaemonInfo queries the serving process over the kernel-authenticated Unix socket.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, sess *session.Session) error

Delete permanently destroys the exact persisted generation.

func (*Client) DeleteGeneration

func (c *Client) DeleteGeneration(ctx context.Context, claim GenerationBinding) (DeleteResult, error)

DeleteGeneration permanently deletes one exact owner/session/ref/generation binding.

func (*Client) DeletePlacement

DeletePlacement removes one exact schedule-owned logical attachment. The server receives only whether dirty state was retained; daemon paths stay private to the adapter.

func (*Client) Fork

func (c *Client) Fork(ctx context.Context, base tool.Environment, label string) (tool.Environment, func() error, string, error)

Fork asks microvmd to create a complete isolated child generation.

func (*Client) Inventory

func (c *Client) Inventory(ctx context.Context, owner string, requests ...InventoryRequest) (InventoryPage, error)

Inventory retrieves one bounded inventory page visible to owner.

func (*Client) LifecycleMetrics

func (c *Client) LifecycleMetrics(ctx context.Context) (LifecycleMetrics, error)

LifecycleMetrics retrieves the current daemon lifecycle counters without binding the request to one environment generation.

func (*Client) Merge

func (c *Client) Merge(ctx context.Context, child, parent tool.Environment) error

Merge asks microvmd to conflict-check and atomically apply child changes.

func (*Client) Reattach

Reattach restores only the exact persisted microVM generation.

func (*Client) ShutdownDaemon

func (c *Client) ShutdownDaemon(ctx context.Context, expected DaemonInfo) error

ShutdownDaemon asks the exact authenticated daemon identity to stop gracefully. It is an internal manager operation, not a placement or user administration API.

type DaemonInfo

type DaemonInfo struct {
	ProtocolVersion uint16   `json:"protocol_version"`
	ReleaseIdentity string   `json:"release_identity"`
	BinaryIdentity  string   `json:"binary_identity"`
	ConfigDigest    string   `json:"config_digest"`
	PolicyRevision  string   `json:"policy_revision"`
	Profiles        []string `json:"profiles"`
	Socket          string   `json:"socket"`
}

DaemonInfo is the authenticated identity of the process serving the configured socket.

func (DaemonInfo) Equal

func (d DaemonInfo) Equal(other DaemonInfo) bool

Equal reports an exact daemon compatibility match.

type DeleteResult

type DeleteResult struct {
	WorktreePath     string `json:"worktree_path"`
	WorktreeRetained bool   `json:"worktree_retained"`
}

DeleteResult reports clean removal or the retained dirty worktree.

type GenerationBinding

type GenerationBinding struct {
	Owner         string `json:"owner"`
	SessionID     string `json:"session_id"`
	EnvironmentID string `json:"environment_id"`
	Ref           string `json:"ref"`
	Generation    uint32 `json:"generation"`
}

GenerationBinding binds a destructive operation to one exact owner generation.

type GenerationHealth

type GenerationHealth string

GenerationHealth is microvmd's bounded operator health classification.

const (
	// GenerationHealthy means the daemon verified the exact live runtime identity.
	GenerationHealthy GenerationHealth = "healthy"
	// GenerationStale means the durable generation is not currently reattachable.
	GenerationStale GenerationHealth = "stale"
	// GenerationError means the runtime health probe itself failed.
	GenerationError GenerationHealth = "error"
)

type InventoryEntry

type InventoryEntry struct {
	Owner         string           `json:"owner"`
	SessionID     string           `json:"session_id"`
	EnvironmentID string           `json:"environment_id"`
	Ref           string           `json:"ref"`
	WorktreePath  string           `json:"worktree_path"`
	Generation    uint32           `json:"generation"`
	State         string           `json:"state"`
	Health        GenerationHealth `json:"health"`
	Error         string           `json:"error,omitempty"`
}

InventoryEntry is one owner-filtered exact daemon generation.

type InventoryPage

type InventoryPage struct {
	Entries      []InventoryEntry `json:"entries"`
	Continuation string           `json:"continuation,omitempty"`
}

InventoryPage carries one bounded inventory page and its opaque continuation.

type InventoryRequest

type InventoryRequest struct {
	PageSize     int    `json:"page_size,omitempty"`
	Continuation string `json:"continuation,omitempty"`
}

InventoryRequest asks for one bounded owner-scoped page.

type LifecycleMetrics

type LifecycleMetrics struct {
	EgressDenials uint64
}

LifecycleMetrics is the bounded operator snapshot exposed by microvmd. The root adapter projects only counters needed by host-side operational checks.

Jump to

Keyboard shortcuts

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