api

package
v0.0.0-...-2bf4b53 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Index

Constants

View Source
const (
	SigningReadOperation  = "read"
	SigningWriteOperation = "write"
)
View Source
const (
	// EncodingGzip is the gzip content encoding.
	EncodingGzip = "gzip"
	// EncodingIdentity means no encoding (passthrough).
	EncodingIdentity = "identity"
	// EncodingWildcard means any encoding is acceptable.
	EncodingWildcard = "*"
)

Variables

View Source
var (
	ErrAccessTokenMismatch           = errors.New("access token validation failed")
	ErrAccessTokenResetNotAuthorized = errors.New("access token reset not authorized")
)
View Source
var (
	ErrInvalidAddress       = errors.New("invalid IP address")
	ErrUnknownAddressFormat = errors.New("unknown IP address format")
)
View Source
var (
	ErrTokenNotSet = errors.New("access token not set")
	ErrTokenEmpty  = errors.New("empty token not allowed")
)
View Source
var ErrNoDiskSpace = errors.New("not enough disk space available")
View Source
var SupportedEncodings = []string{
	EncodingGzip,
}

SupportedEncodings lists the content encodings supported for file transfer. The order matters - encodings are checked in order of preference.

Functions

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type API

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

func New

func New(l *zerolog.Logger, defaults *execcontext.Defaults, mmdsChan chan *host.MMDSOpts, isNotFC bool, workloadFreezer *cgroups.WorkloadFreezer) *API

func (*API) ExportMounts

func (a *API) ExportMounts() []*upgrade.MountEntry

ExportMounts snapshots the NFS mount ledger (path -> lifecycle id) as typed MountEntry messages, carried across an envd live-upgrade. The kernel mounts survive the same-PID execve, but the ledger lives only in envd's heap; without it the new envd's post-upgrade /init would see an empty ledger, decide every volume needs (re)mounting, and force-unmount + remount a still-live mount — risking ESTALE for the workload and a failed resume. Carrying it lets /init recognize a matching-lifecycle mount and leave it in place.

func (*API) GetEnvs

func (a *API) GetEnvs(w http.ResponseWriter, _ *http.Request)

func (*API) GetFiles

func (a *API) GetFiles(w http.ResponseWriter, r *http.Request, params GetFilesParams)

func (*API) GetHealth

func (a *API) GetHealth(w http.ResponseWriter, r *http.Request)

func (*API) GetMetrics

func (a *API) GetMetrics(w http.ResponseWriter, r *http.Request)

func (*API) ImportMounts

func (a *API) ImportMounts(mounts []*upgrade.MountEntry)

ImportMounts restores the NFS mount ledger from a live-upgrade handover so the new envd knows which paths are already mounted (and for which lifecycle) before its first post-upgrade /init runs setupNFS.

func (*API) Initialized

func (a *API) Initialized() bool

Initialized reports whether the first authenticated /init has completed.

func (*API) PostCollapse

func (a *API) PostCollapse(w http.ResponseWriter, r *http.Request)

PostCollapse compacts envd's own anonymous heap into 2 MiB transparent hugepages just before pause. envd's Go heap arenas are physically scattered across many 2 MiB guest-physical frames, each of which is a separate cold fault on resume; consolidating them lets envd-init touch far fewer frames. Best-effort: a collapse failure is logged but a non-empty result still returns success, since the snapshot is taken regardless. The per-call stats are returned so the orchestrator can record them as metrics and span attributes.

func (*API) PostFiles

func (a *API) PostFiles(w http.ResponseWriter, r *http.Request, params PostFilesParams)

func (*API) PostFilesCompose

func (a *API) PostFilesCompose(w http.ResponseWriter, r *http.Request)

func (*API) PostFreeze

func (a *API) PostFreeze(w http.ResponseWriter, r *http.Request, params PostFreezeParams)

userCgroupsToFreeze is the cgroup set frozen pre-pause and thawed on /init. PostFreeze freezes user/pty cgroups directly (no Process.Start / shell). Orchestrator calls this just before pause; the frozen state persists into the snapshot and /init thaws on resume. Best-effort: tries every cgroup even if one fails so we freeze as many as possible before the snapshot.

func (*API) PostFsfreeze

func (a *API) PostFsfreeze(w http.ResponseWriter, r *http.Request)

PostFsfreeze freezes the guest rootfs (FIFREEZE) so it is flushed to a consistent on-disk state before a filesystem-only pause. This closes the sync->pause race: without a memory snapshot, a write acknowledged after the pre-pause sync but before the VM pause would otherwise be lost on the reboot resume. Idempotent: freezing an already-frozen filesystem is a no-op. On a successful filesystem-only pause the VM is rebooted, so no thaw is needed; the orchestrator thaws (PostFsthaw) only on the pause-failure rollback path.

func (*API) PostFsthaw

func (a *API) PostFsthaw(w http.ResponseWriter, r *http.Request)

PostFsthaw thaws the guest rootfs (FITHAW). Exists ONLY for the orchestrator's pause-failure rollback path, so a frozen filesystem cannot leave the live VM deadlocked. Idempotent: thawing a filesystem that is not frozen is a no-op.

func (*API) PostInit

func (a *API) PostInit(w http.ResponseWriter, r *http.Request)

func (*API) PostUnfreeze

func (a *API) PostUnfreeze(w http.ResponseWriter, r *http.Request)

PostUnfreeze thaws user/pty cgroups directly. Exists ONLY for the orchestrator's pause-failure rollback path; the resume thaw runs via /init's deferred unfreeze and must not be replaced by this endpoint. Best-effort: tries every cgroup even if one fails so a partial failure cannot leave the rest frozen.

func (*API) SetData

func (a *API) SetData(ctx context.Context, logger zerolog.Logger, data PostInitJSONBody) error

func (*API) SetHandoverResult

func (a *API) SetHandoverResult(failed bool, procs, procsFailed, retained, retainedFailed, watchers, watchersFailed int)

SetHandoverResult records the live-upgrade handover outcome so PostInit can advertise it. Called once at startup (before serving) when this envd booted via --resume-handover. failed reports whether the handover itself failed (the workload was not re-adopted), so the orchestrator can tear the sandbox down rather than mistake the version flip for success.

func (*API) SetupHyperloop

func (a *API) SetupHyperloop(address string)

func (*API) WithAuthorization

func (a *API) WithAuthorization(handler http.Handler) http.Handler

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type CollapseResult

type CollapseResult struct {
	// AlreadyHuge Chunks MADV_COLLAPSE accepted but were already hugepages (no work)
	AlreadyHuge *int `json:"alreadyHuge,omitempty"`

	// Chunks 2 MiB chunks attempted
	Chunks *int `json:"chunks,omitempty"`

	// Collapsed Chunks whose base pages were actually migrated into a new hugepage (real work)
	Collapsed *int `json:"collapsed,omitempty"`

	// ElapsedMs Wall-clock time spent collapsing, in milliseconds
	ElapsedMs *int64 `json:"elapsedMs,omitempty"`

	// Regions Anonymous read-write regions scanned
	Regions *int `json:"regions,omitempty"`

	// Skipped Chunks that could not be collapsed (empty or ineligible)
	Skipped *int `json:"skipped,omitempty"`
}

CollapseResult Per-call statistics from a heap collapse

type ComposeRequest

type ComposeRequest struct {
	// Destination Destination file path for the composed file
	Destination string `json:"destination"`

	// SourcePaths Ordered list of source file paths to concatenate
	SourcePaths []string `json:"source_paths"`

	// Username User for setting ownership and resolving relative paths
	Username *string `json:"username,omitempty"`
}

ComposeRequest defines model for ComposeRequest.

type DefaultMMDSClient

type DefaultMMDSClient struct{}

DefaultMMDSClient is the production implementation that calls the real MMDS endpoint.

func (*DefaultMMDSClient) GetAccessTokenHash

func (c *DefaultMMDSClient) GetAccessTokenHash(ctx context.Context) (string, error)

type EntryInfo

type EntryInfo struct {
	// Metadata User-defined metadata stored as extended attributes on the file.
	Metadata *map[string]string `json:"metadata,omitempty"`

	// Name Name of the file
	Name string `json:"name"`

	// Path Path to the file
	Path string `json:"path"`

	// Type Type of the file
	Type EntryInfoType `json:"type"`
}

EntryInfo defines model for EntryInfo.

type EntryInfoType

type EntryInfoType string

EntryInfoType Type of the file

const (
	File EntryInfoType = "file"
)

Defines values for EntryInfoType.

func (EntryInfoType) Valid

func (e EntryInfoType) Valid() bool

Valid indicates whether the value is a known member of the EntryInfoType enum.

type EnvVars

type EnvVars map[string]string

EnvVars Environment variables to set

type Error

type Error struct {
	// Code Error code
	Code int `json:"code"`

	// Message Error message
	Message string `json:"message"`
}

Error defines model for Error.

type FileNotFound

type FileNotFound = Error

FileNotFound defines model for FileNotFound.

type FilePath

type FilePath = string

FilePath defines model for FilePath.

type FreezeResult

type FreezeResult struct {
	// Allowlisted Cgroups skipped because the resume path depends on them (systemd, journald, envd's port forwarding). Reported because the allowlist is expected to grow, and a distro that routes journald differently changes this count
	Allowlisted *int `json:"allowlisted,omitempty"`

	// Failed Cgroups whose freeze write or state read errored (expected for a threaded cgroup, and for one removed mid-sweep)
	Failed *int `json:"failed,omitempty"`

	// Frozen Cgroups that read back "frozen 1" from cgroup.events within the budget; their tasks have stopped
	Frozen *int `json:"frozen,omitempty"`

	// Mode Which sweep actually ran. Echoed back rather than inferred from the flag, so a caller can tell that envd honoured what it asked for
	Mode *FreezeResultMode `json:"mode,omitempty"`

	// NotFrozen Cgroups still reading "frozen 0" when the budget expired; their tasks may still be running, so a snapshot taken now can capture a live workload
	NotFrozen *int `json:"notFrozen,omitempty"`

	// PreFrozen Cgroups the guest itself had already frozen before the sweep ran (docker pause writes cgroup.freeze). Not written to and deliberately left frozen by the resume thaw, so the guest's own suspension survives the snapshot
	PreFrozen *int `json:"preFrozen,omitempty"`

	// Requested Cgroups this call wrote cgroup.freeze to
	Requested *int `json:"requested,omitempty"`

	// SweepMs Time spent issuing the freeze writes, in milliseconds (scales with cgroup count)
	SweepMs *int64 `json:"sweepMs,omitempty"`

	// Truncated True when the walk stopped because it hit the bound rather than because it ran out of tree, so coverage is incomplete
	Truncated *bool `json:"truncated,omitempty"`

	// Unobservable Cgroups whose freeze state cannot be read because this guest has no cgroup manager; the write was accepted but nothing can be read back, so these are neither frozen nor notFrozen
	Unobservable *int `json:"unobservable,omitempty"`

	// Visited Cgroups the walk examined, whether or not it froze them. The input for sizing the bound; meaningless in legacy mode
	Visited *int `json:"visited,omitempty"`

	// WaitMs Time spent polling cgroup.events, in milliseconds (scales with how deep in I/O the guest tasks were). Outcome neutral - the wait ends either because everything stopped or because the budget ran out
	WaitMs *int64 `json:"waitMs,omitempty"`
}

FreezeResult Per-call statistics from a pre-pause workload freeze

type FreezeResultMode

type FreezeResultMode string

FreezeResultMode Which sweep actually ran. Echoed back rather than inferred from the flag, so a caller can tell that envd honoured what it asked for

const (
	FreezeResultModeHierarchy FreezeResultMode = "hierarchy"
	FreezeResultModeLegacy    FreezeResultMode = "legacy"
)

Defines values for FreezeResultMode.

func (FreezeResultMode) Valid

func (e FreezeResultMode) Valid() bool

Valid indicates whether the value is a known member of the FreezeResultMode enum.

type GetFilesParams

type GetFilesParams struct {
	// Path Path to the file, URL encoded. Can be relative to the user's home directory (e.g. "file.txt" resolves to ~/file.txt).
	Path *FilePath `form:"path,omitempty" json:"path,omitempty"`

	// Username User for setting file ownership and resolving relative paths. Defaults to the sandbox's default user.
	Username *User `form:"username,omitempty" json:"username,omitempty"`

	// Signature Signature used for file access permission verification.
	Signature *Signature `form:"signature,omitempty" json:"signature,omitempty"`

	// SignatureExpiration Unix timestamp (seconds) after which the signature expires. Only used with the signature parameter.
	SignatureExpiration *SignatureExpiration `form:"signature_expiration,omitempty" json:"signature_expiration,omitempty"`
}

GetFilesParams defines parameters for GetFiles.

type InternalServerError

type InternalServerError = Error

InternalServerError defines model for InternalServerError.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type InvalidPath

type InvalidPath = Error

InvalidPath defines model for InvalidPath.

type InvalidUser

type InvalidUser = Error

InvalidUser defines model for InvalidUser.

type MMDSClient

type MMDSClient interface {
	GetAccessTokenHash(ctx context.Context) (string, error)
}

MMDSClient provides access to MMDS metadata.

type Metrics

type Metrics struct {
	// CpuCount Number of CPU cores
	CpuCount *int `json:"cpu_count,omitempty"`

	// CpuUsedPct CPU usage percentage
	CpuUsedPct *float32 `json:"cpu_used_pct,omitempty"`

	// DiskTotal Total disk space in bytes
	DiskTotal *int `json:"disk_total,omitempty"`

	// DiskUsed Used disk space in bytes
	DiskUsed *int `json:"disk_used,omitempty"`

	// MemCache Cached memory (page cache) in bytes
	MemCache *int `json:"mem_cache,omitempty"`

	// MemTotal Total virtual memory in bytes
	MemTotal *int `json:"mem_total,omitempty"`

	// MemTotalMib Total virtual memory in MiB
	MemTotalMib *int `json:"mem_total_mib,omitempty"`

	// MemUsed Used virtual memory in bytes
	MemUsed *int `json:"mem_used,omitempty"`

	// MemUsedMib Used virtual memory in MiB
	MemUsedMib *int `json:"mem_used_mib,omitempty"`

	// Ts Unix timestamp in UTC for current sandbox time
	Ts *int64 `json:"ts,omitempty"`
}

Metrics Resource usage metrics

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type NotAcceptable

type NotAcceptable = Error

NotAcceptable defines model for NotAcceptable.

type NotEnoughDiskSpace

type NotEnoughDiskSpace = Error

NotEnoughDiskSpace defines model for NotEnoughDiskSpace.

type PostFilesComposeJSONRequestBody

type PostFilesComposeJSONRequestBody = ComposeRequest

PostFilesComposeJSONRequestBody defines body for PostFilesCompose for application/json ContentType.

type PostFilesMultipartBody

type PostFilesMultipartBody struct {
	File *openapi_types.File `json:"file,omitempty"`
}

PostFilesMultipartBody defines parameters for PostFiles.

type PostFilesMultipartRequestBody

type PostFilesMultipartRequestBody PostFilesMultipartBody

PostFilesMultipartRequestBody defines body for PostFiles for multipart/form-data ContentType.

type PostFilesParams

type PostFilesParams struct {
	// Path Path to the file, URL encoded. Can be relative to the user's home directory (e.g. "file.txt" resolves to ~/file.txt).
	Path *FilePath `form:"path,omitempty" json:"path,omitempty"`

	// Username User for setting file ownership and resolving relative paths. Defaults to the sandbox's default user.
	Username *User `form:"username,omitempty" json:"username,omitempty"`

	// Signature Signature used for file access permission verification.
	Signature *Signature `form:"signature,omitempty" json:"signature,omitempty"`

	// SignatureExpiration Unix timestamp (seconds) after which the signature expires. Only used with the signature parameter.
	SignatureExpiration *SignatureExpiration `form:"signature_expiration,omitempty" json:"signature_expiration,omitempty"`
}

PostFilesParams defines parameters for PostFiles.

type PostFreezeParams

type PostFreezeParams struct {
	// Mode Which cgroups to freeze. "hierarchy" freezes the complement of envd's own
	// ancestor chain, so cgroups the customer created anywhere in the tree are
	// covered; "legacy" freezes only the user and pty cgroups envd itself creates.
	// Omitted means legacy, which is what an orchestrator predating this parameter
	// gets.
	//
	// The mode is chosen by the caller because the feature flag that selects it is
	// evaluated there — envd has no access to it. FreezeResult echoes the mode back
	// so the caller can confirm envd honoured the request rather than inferring it
	// from the flag's value: an envd too old to know about modes reports legacy
	// while the flag reads on.
	Mode *PostFreezeParamsMode `form:"mode,omitempty" json:"mode,omitempty"`

	// MaxCgroups Bounds how many cgroups a hierarchy sweep may visit. A safety guard against a
	// pathological or hostile hierarchy rather than a performance knob — the guest is
	// the threat model. Omitted or non-positive means envd's own default. Ignored in
	// legacy mode.
	MaxCgroups *int `form:"maxCgroups,omitempty" json:"maxCgroups,omitempty"`

	// MaxWaitMs How long to wait for the cgroups to read back frozen, in milliseconds. The
	// caller owns this budget because it also owns the request timeout, and a wait
	// longer than that timeout cannot be observed.
	//
	// Supplying it also selects the response: with it, the call waits and answers 200
	// with a FreezeResult; omitted or non-positive, the call does not wait at all and
	// answers 204, which is the contract callers older than this parameter expect.
	MaxWaitMs *int64 `form:"maxWaitMs,omitempty" json:"maxWaitMs,omitempty"`
}

PostFreezeParams defines parameters for PostFreeze.

type PostFreezeParamsMode

type PostFreezeParamsMode string

PostFreezeParamsMode defines parameters for PostFreeze.

const (
	PostFreezeParamsModeHierarchy PostFreezeParamsMode = "hierarchy"
	PostFreezeParamsModeLegacy    PostFreezeParamsMode = "legacy"
)

Defines values for PostFreezeParamsMode.

func (PostFreezeParamsMode) Valid

func (e PostFreezeParamsMode) Valid() bool

Valid indicates whether the value is a known member of the PostFreezeParamsMode enum.

type PostInitJSONBody

type PostInitJSONBody struct {
	// AccessToken Access token for secure access to envd service
	AccessToken *SecureToken `json:"accessToken,omitempty"`

	// CaBundle PEM-encoded CA certificates to install into the system trust store (may contain multiple concatenated PEM blocks)
	CaBundle *string `json:"caBundle,omitempty"`

	// DefaultUser The default user to use for operations
	DefaultUser *string `json:"defaultUser,omitempty"`

	// DefaultWorkdir The default working directory to use for operations
	DefaultWorkdir *string `json:"defaultWorkdir,omitempty"`

	// EnvVars Environment variables to set
	EnvVars *EnvVars `json:"envVars,omitempty"`

	// HyperloopIP IP address of the hyperloop server to connect to
	HyperloopIP *string `json:"hyperloopIP,omitempty"`

	// LifecycleID Lifecycle ID of the sandbox
	LifecycleID *string `json:"lifecycleID,omitempty"`

	// Timestamp The current timestamp in RFC3339 format
	Timestamp    *time.Time     `json:"timestamp,omitempty"`
	VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"`
}

PostInitJSONBody defines parameters for PostInit.

type PostInitJSONRequestBody

type PostInitJSONRequestBody PostInitJSONBody

PostInitJSONRequestBody defines body for PostInit for application/json ContentType.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type SecureToken

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

SecureToken wraps memguard for secure token storage. It uses LockedBuffer which provides memory locking, guard pages, and secure zeroing on destroy.

func (*SecureToken) Bytes

func (s *SecureToken) Bytes() ([]byte, error)

Bytes returns a copy of the token bytes (for signature generation). The caller should zero the returned slice after use. Returns ErrTokenNotSet if the receiver is nil.

func (*SecureToken) Destroy

func (s *SecureToken) Destroy()

Destroy securely wipes the token from memory. No-op if the receiver is nil.

func (*SecureToken) Equals

func (s *SecureToken) Equals(token string) bool

Equals checks if token matches using constant-time comparison. Returns false if the receiver is nil.

func (*SecureToken) EqualsSecure

func (s *SecureToken) EqualsSecure(other *SecureToken) bool

EqualsSecure compares this token with another SecureToken using constant-time comparison. Returns false if either receiver or other is nil.

func (*SecureToken) IsSet

func (s *SecureToken) IsSet() bool

IsSet returns true if a token is stored. Returns false if the receiver is nil.

func (*SecureToken) Set

func (s *SecureToken) Set(token []byte) error

Set securely replaces the token, destroying the old one first. The old token memory is zeroed before the new token is stored. The input byte slice is wiped after copying to secure memory. Returns ErrTokenEmpty if token is empty - use Destroy() to clear the token instead.

func (*SecureToken) TakeFrom

func (s *SecureToken) TakeFrom(src *SecureToken)

TakeFrom transfers the token from src to this SecureToken, destroying any existing token. The source token is cleared after transfer. This avoids copying the underlying bytes.

func (*SecureToken) UnmarshalJSON

func (s *SecureToken) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler to securely parse a JSON string directly into memguard, wiping the input bytes after copying.

Access tokens are hex-encoded HMAC-SHA256 hashes (64 chars of [0-9a-f]), so they never contain JSON escape sequences.

type ServerInterface

type ServerInterface interface {
	// PostCollapse Collapse envd's own anonymous heap into 2 MiB transparent hugepages before pause, so on resume envd touches fewer distinct guest-physical frames (each a cold fault). Best-effort.
	// (POST /collapse)
	PostCollapse(w http.ResponseWriter, r *http.Request)
	// GetEnvs Environment variables
	// (GET /envs)
	GetEnvs(w http.ResponseWriter, r *http.Request)
	// GetFiles Download a file
	// (GET /files)
	GetFiles(w http.ResponseWriter, r *http.Request, params GetFilesParams)
	// PostFiles Upload a file and ensure the parent directories exist. If the file exists, it will be overwritten.
	// (POST /files)
	PostFiles(w http.ResponseWriter, r *http.Request, params PostFilesParams)
	// PostFilesCompose Compose multiple files into a single file using zero-copy concatenation. Source files are deleted after successful composition.
	// (POST /files/compose)
	PostFilesCompose(w http.ResponseWriter, r *http.Request)
	// PostFreeze Freeze user/pty cgroups before pause and wait for them to stop. Written directly by envd to avoid Process.Start / shell overhead under load.
	// (POST /freeze)
	PostFreeze(w http.ResponseWriter, r *http.Request, params PostFreezeParams)
	// PostFsfreeze Freeze the guest rootfs (FIFREEZE) before a filesystem-only pause so it is flushed to a consistent on-disk state, closing the sync->pause race. Idempotent. On a successful filesystem-only pause the VM is rebooted, so no thaw is needed; the orchestrator thaws only on the pause-failure path.
	// (POST /fsfreeze)
	PostFsfreeze(w http.ResponseWriter, r *http.Request)
	// PostFsthaw Thaw the guest rootfs (FITHAW). Intended ONLY for the orchestrator's pause-failure rollback path, so a frozen filesystem cannot leave the live VM deadlocked. Idempotent.
	// (POST /fsthaw)
	PostFsthaw(w http.ResponseWriter, r *http.Request)
	// GetHealth Check the health of the service
	// (GET /health)
	GetHealth(w http.ResponseWriter, r *http.Request)
	// PostInit Set initial vars, ensure the time and metadata is synced with the host
	// (POST /init)
	PostInit(w http.ResponseWriter, r *http.Request)
	// GetMetrics Service stats
	// (GET /metrics)
	GetMetrics(w http.ResponseWriter, r *http.Request)
	// PostUnfreeze Unfreeze user/pty cgroups. Intended ONLY for the orchestrator's pause-failure rollback path; the normal resume thaw happens via /init's deferred unfreeze, not here.
	// (POST /unfreeze)
	PostUnfreeze(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) GetEnvs

GetEnvs operation middleware

func (*ServerInterfaceWrapper) GetFiles

func (siw *ServerInterfaceWrapper) GetFiles(w http.ResponseWriter, r *http.Request)

GetFiles operation middleware

func (*ServerInterfaceWrapper) GetHealth

func (siw *ServerInterfaceWrapper) GetHealth(w http.ResponseWriter, r *http.Request)

GetHealth operation middleware

func (*ServerInterfaceWrapper) GetMetrics

func (siw *ServerInterfaceWrapper) GetMetrics(w http.ResponseWriter, r *http.Request)

GetMetrics operation middleware

func (*ServerInterfaceWrapper) PostCollapse

func (siw *ServerInterfaceWrapper) PostCollapse(w http.ResponseWriter, r *http.Request)

PostCollapse operation middleware

func (*ServerInterfaceWrapper) PostFiles

func (siw *ServerInterfaceWrapper) PostFiles(w http.ResponseWriter, r *http.Request)

PostFiles operation middleware

func (*ServerInterfaceWrapper) PostFilesCompose

func (siw *ServerInterfaceWrapper) PostFilesCompose(w http.ResponseWriter, r *http.Request)

PostFilesCompose operation middleware

func (*ServerInterfaceWrapper) PostFreeze

func (siw *ServerInterfaceWrapper) PostFreeze(w http.ResponseWriter, r *http.Request)

PostFreeze operation middleware

func (*ServerInterfaceWrapper) PostFsfreeze

func (siw *ServerInterfaceWrapper) PostFsfreeze(w http.ResponseWriter, r *http.Request)

PostFsfreeze operation middleware

func (*ServerInterfaceWrapper) PostFsthaw

func (siw *ServerInterfaceWrapper) PostFsthaw(w http.ResponseWriter, r *http.Request)

PostFsthaw operation middleware

func (*ServerInterfaceWrapper) PostInit

func (siw *ServerInterfaceWrapper) PostInit(w http.ResponseWriter, r *http.Request)

PostInit operation middleware

func (*ServerInterfaceWrapper) PostUnfreeze

func (siw *ServerInterfaceWrapper) PostUnfreeze(w http.ResponseWriter, r *http.Request)

PostUnfreeze operation middleware

type Signature

type Signature = string

Signature defines model for Signature.

type SignatureExpiration

type SignatureExpiration = int

SignatureExpiration defines model for SignatureExpiration.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented

type Unimplemented struct{}

func (Unimplemented) GetEnvs

func (_ Unimplemented) GetEnvs(w http.ResponseWriter, r *http.Request)

GetEnvs Environment variables (GET /envs)

func (Unimplemented) GetFiles

func (_ Unimplemented) GetFiles(w http.ResponseWriter, r *http.Request, params GetFilesParams)

GetFiles Download a file (GET /files)

func (Unimplemented) GetHealth

func (_ Unimplemented) GetHealth(w http.ResponseWriter, r *http.Request)

GetHealth Check the health of the service (GET /health)

func (Unimplemented) GetMetrics

func (_ Unimplemented) GetMetrics(w http.ResponseWriter, r *http.Request)

GetMetrics Service stats (GET /metrics)

func (Unimplemented) PostCollapse

func (_ Unimplemented) PostCollapse(w http.ResponseWriter, r *http.Request)

PostCollapse Collapse envd's own anonymous heap into 2 MiB transparent hugepages before pause, so on resume envd touches fewer distinct guest-physical frames (each a cold fault). Best-effort. (POST /collapse)

func (Unimplemented) PostFiles

func (_ Unimplemented) PostFiles(w http.ResponseWriter, r *http.Request, params PostFilesParams)

PostFiles Upload a file and ensure the parent directories exist. If the file exists, it will be overwritten. (POST /files)

func (Unimplemented) PostFilesCompose

func (_ Unimplemented) PostFilesCompose(w http.ResponseWriter, r *http.Request)

PostFilesCompose Compose multiple files into a single file using zero-copy concatenation. Source files are deleted after successful composition. (POST /files/compose)

func (Unimplemented) PostFreeze

func (_ Unimplemented) PostFreeze(w http.ResponseWriter, r *http.Request, params PostFreezeParams)

PostFreeze Freeze user/pty cgroups before pause and wait for them to stop. Written directly by envd to avoid Process.Start / shell overhead under load. (POST /freeze)

func (Unimplemented) PostFsfreeze

func (_ Unimplemented) PostFsfreeze(w http.ResponseWriter, r *http.Request)

PostFsfreeze Freeze the guest rootfs (FIFREEZE) before a filesystem-only pause so it is flushed to a consistent on-disk state, closing the sync->pause race. Idempotent. On a successful filesystem-only pause the VM is rebooted, so no thaw is needed; the orchestrator thaws only on the pause-failure path. (POST /fsfreeze)

func (Unimplemented) PostFsthaw

func (_ Unimplemented) PostFsthaw(w http.ResponseWriter, r *http.Request)

PostFsthaw Thaw the guest rootfs (FITHAW). Intended ONLY for the orchestrator's pause-failure rollback path, so a frozen filesystem cannot leave the live VM deadlocked. Idempotent. (POST /fsthaw)

func (Unimplemented) PostInit

func (_ Unimplemented) PostInit(w http.ResponseWriter, r *http.Request)

PostInit Set initial vars, ensure the time and metadata is synced with the host (POST /init)

func (Unimplemented) PostUnfreeze

func (_ Unimplemented) PostUnfreeze(w http.ResponseWriter, r *http.Request)

PostUnfreeze Unfreeze user/pty cgroups. Intended ONLY for the orchestrator's pause-failure rollback path; the normal resume thaw happens via /init's deferred unfreeze, not here. (POST /unfreeze)

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UploadSuccess

type UploadSuccess = []EntryInfo

UploadSuccess defines model for UploadSuccess.

type User

type User = string

User defines model for User.

type VolumeMount

type VolumeMount struct {
	// NfsTarget Server target address
	NfsTarget string `json:"nfs_target"`

	// Path Mount path inside the sandbox
	Path string `json:"path"`
}

VolumeMount Volume mount configuration

Jump to

Keyboard shortcuts

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