Documentation
¶
Index ¶
- Constants
- Variables
- func IsAlreadyExists(err error) bool
- func IsConflict(err error) bool
- func IsNotFound(err error) bool
- func IsRuntime(err error) bool
- func ResolveConfSource(dataDir string) (string, error)
- type CPUMetrics
- type CommitSnapshotRequest
- type ContainerInfo
- type ContainerMetrics
- type ContainerService
- type ContainerSpec
- type CreateContainerRequest
- type DeleteContainerOptions
- type DeleteImageOptions
- type DeleteTaskOptions
- type ImageInfo
- type ImageService
- type LayerStatus
- type ListSnapshotsRequest
- type ListTasksOptions
- type MemoryMetrics
- type MountInfo
- type MountSpec
- type NetworkJoinTarget
- type NetworkRequest
- type NetworkResult
- type NetworkService
- type PrepareSnapshotRequest
- type PullImageOptions
- type PullProgress
- type ResourceLimits
- type RuntimeInfo
- type Service
- type SnapshotInfo
- type SnapshotRef
- type SnapshotService
- type SnapshotUsage
- type StartTaskOptions
- type StopTaskOptions
- type StorageRef
- type TaskInfo
- type TaskStatus
- type WorkloadService
Constants ¶
const ( DefaultSocketPath = "/run/containerd/containerd.sock" DefaultNamespace = "default" BackendContainerd = "containerd" BackendApple = "apple" BackendDocker = "docker" )
const ( // StorageKeyLabel stores the runtime-specific active storage key on backends // whose container metadata does not expose one natively. StorageKeyLabel = "memoh.storage_key" )
Variables ¶
var ( ErrInvalidArgument = errors.New("invalid argument") ErrNotSupported = errors.New("operation not supported on this backend") ErrNotFound = errors.New("not found") ErrAlreadyExists = errors.New("already exists") ErrConflict = errors.New("conflict") ErrRuntime = errors.New("runtime operation failed") )
Functions ¶
func IsAlreadyExists ¶
func IsConflict ¶
func IsNotFound ¶
func ResolveConfSource ¶
ResolveConfSource returns a host path to mount as /etc/resolv.conf.
Types ¶
type CPUMetrics ¶
type CommitSnapshotRequest ¶
type CommitSnapshotRequest struct {
Source StorageRef
Target SnapshotRef
}
type ContainerInfo ¶
type ContainerInfo struct {
ID string
Image string
Labels map[string]string
StorageRef StorageRef
Runtime RuntimeInfo
CreatedAt time.Time
UpdatedAt time.Time
}
type ContainerMetrics ¶
type ContainerMetrics struct {
SampledAt time.Time
CPU *CPUMetrics
Memory *MemoryMetrics
}
type ContainerService ¶
type ContainerService interface {
CreateContainer(ctx context.Context, req CreateContainerRequest) (ContainerInfo, error)
GetContainer(ctx context.Context, id string) (ContainerInfo, error)
ListContainers(ctx context.Context) ([]ContainerInfo, error)
DeleteContainer(ctx context.Context, id string, opts *DeleteContainerOptions) error
ListContainersByLabel(ctx context.Context, key, value string) ([]ContainerInfo, error)
}
ContainerService groups container metadata and creation operations.
type ContainerSpec ¶
type ContainerSpec struct {
Cmd []string
Env []string
WorkDir string
User string
Mounts []MountSpec
DNS []string
NetworkJoinTarget NetworkJoinTarget
AddedCapabilities []string
// CDIDevices contains fully-qualified CDI device names such as
// "nvidia.com/gpu=0" or "amd.com/gpu=0".
CDIDevices []string
TTY bool
}
type CreateContainerRequest ¶
type CreateContainerRequest struct {
ID string
ImageRef string
ImagePullPolicy string
StorageRef StorageRef
ResourceLimits ResourceLimits
Labels map[string]string
Spec ContainerSpec
}
type DeleteContainerOptions ¶
type DeleteContainerOptions struct {
CleanupSnapshot bool
}
type DeleteImageOptions ¶
type DeleteImageOptions struct {
Synchronous bool
}
type DeleteTaskOptions ¶
type DeleteTaskOptions struct {
Force bool
}
type ImageService ¶
type ImageService interface {
PullImage(ctx context.Context, ref string, opts *PullImageOptions) (ImageInfo, error)
GetImage(ctx context.Context, ref string) (ImageInfo, error)
ListImages(ctx context.Context) ([]ImageInfo, error)
DeleteImage(ctx context.Context, ref string, opts *DeleteImageOptions) error
// ResolveRemoteDigest fetches only the manifest digest from the registry
// without downloading any layers. Returns ErrNotSupported on backends that
// have no concept of a remote registry.
ResolveRemoteDigest(ctx context.Context, ref string) (string, error)
}
ImageService groups image and registry operations.
type LayerStatus ¶
type ListSnapshotsRequest ¶
type ListSnapshotsRequest struct {
Driver string
}
type ListTasksOptions ¶
type ListTasksOptions struct {
ContainerID string
}
type MemoryMetrics ¶
type MountSpec ¶
func TimezoneSpec ¶
TimezoneSpec returns environment variables that propagate the host timezone.
type NetworkJoinTarget ¶
NetworkJoinTarget is an adapter-provided handle for runtimes that can attach another workload to the same network stack.
type NetworkRequest ¶
type NetworkRequest struct {
ContainerID string
JoinTarget NetworkJoinTarget
}
NetworkRequest describes a runtime-level network readiness request for a workspace container. Backend-specific details such as CNI configuration live inside the adapter.
type NetworkResult ¶
type NetworkResult struct {
IP string
}
NetworkResult captures the outcome of attaching the container to the default container network.
type NetworkService ¶
type NetworkService interface {
SetupNetwork(ctx context.Context, req NetworkRequest) (NetworkResult, error)
RemoveNetwork(ctx context.Context, req NetworkRequest) error
CheckNetwork(ctx context.Context, req NetworkRequest) error
}
NetworkService groups runtime network attachment operations.
type PrepareSnapshotRequest ¶
type PrepareSnapshotRequest struct {
Target StorageRef
Parent SnapshotRef
}
type PullImageOptions ¶
type PullImageOptions struct {
Unpack bool
StorageDriver string
OnProgress func(PullProgress) // optional, nil = no progress reporting
}
type PullProgress ¶
type PullProgress struct {
Layers []LayerStatus `json:"layers"`
}
type ResourceLimits ¶
ResourceLimits contains desired hard/soft workspace resource limits. A zero value for a field means unlimited.
type RuntimeInfo ¶
type RuntimeInfo struct {
Name string
}
type Service ¶
type Service interface {
ContainerService
WorkloadService
NetworkService
SnapshotService
}
Service is the workspace-facing container runtime abstraction.
type SnapshotInfo ¶
type SnapshotRef ¶
type SnapshotService ¶
type SnapshotService interface {
CommitSnapshot(ctx context.Context, req CommitSnapshotRequest) error
ListSnapshots(ctx context.Context, req ListSnapshotsRequest) ([]SnapshotInfo, error)
PrepareSnapshot(ctx context.Context, req PrepareSnapshotRequest) error
RestoreContainer(ctx context.Context, req CreateContainerRequest) (ContainerInfo, error)
}
SnapshotService groups snapshot lifecycle operations.
type SnapshotUsage ¶
type StartTaskOptions ¶
type StartTaskOptions struct {
Terminal bool
}
type StopTaskOptions ¶
type StorageRef ¶
type TaskInfo ¶
type TaskInfo struct {
ContainerID string
ID string
PID uint32
NetworkJoinTarget NetworkJoinTarget
Status TaskStatus
ExitCode uint32
}
type TaskStatus ¶
type TaskStatus int
const ( TaskStatusUnknown TaskStatus = iota TaskStatusCreated TaskStatusRunning TaskStatusStopped TaskStatusPaused )
func (TaskStatus) String ¶
func (s TaskStatus) String() string
type WorkloadService ¶
type WorkloadService interface {
StartContainer(ctx context.Context, containerID string, opts *StartTaskOptions) error
StopContainer(ctx context.Context, containerID string, opts *StopTaskOptions) error
DeleteTask(ctx context.Context, containerID string, opts *DeleteTaskOptions) error
GetTaskInfo(ctx context.Context, containerID string) (TaskInfo, error)
GetContainerMetrics(ctx context.Context, containerID string) (ContainerMetrics, error)
ListTasks(ctx context.Context, opts *ListTasksOptions) ([]TaskInfo, error)
}
WorkloadService groups primary workload lifecycle operations.