hcs

package
v0.31.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

View Source
var (
	ContainerQuery  = utils.Must(windows.UTF16PtrFromString(`{"Types":["Container"]}`))
	StatisticsQuery = utils.Must(windows.UTF16PtrFromString(`{"PropertyTypes":["Statistics"]}`))
)
View Source
var (
	ErrEmptyResultDocument = errors.New("empty result document")
	ErrIDNotFound          = windows.Errno(2151088398)
)

Functions

func CloseComputeSystem

func CloseComputeSystem(system ComputeSystem)

CloseComputeSystem closes a handle to a compute system.

https://learn.microsoft.com/en-us/virtualization/api/hcs/reference/hcsclosecomputesystem

func CloseOperation

func CloseOperation(operation Operation)

CloseOperation closes an operation.

func EnumerateComputeSystems

func EnumerateComputeSystems(query *uint16, operation Operation) error

EnumerateComputeSystems enumerates compute systems.

https://learn.microsoft.com/en-us/virtualization/api/hcs/reference/hcsenumeratecomputesystems

func GetComputeSystemProperties

func GetComputeSystemProperties(system ComputeSystem, operation Operation, propertyQuery *uint16) error

func WaitForOperationResult

func WaitForOperationResult(operation Operation, timeout uint32) (string, error)

func Win32FromHResult

func Win32FromHResult(hr uintptr) windows.Errno

Types

type ComputeSystem

type ComputeSystem = windows.Handle

func OpenComputeSystem

func OpenComputeSystem(id string) (ComputeSystem, error)

OpenComputeSystem opens a handle to an existing compute system.

https://learn.microsoft.com/en-us/virtualization/api/hcs/reference/hcsopencomputesystem

type MemoryStats

type MemoryStats struct {
	MemoryUsageCommitBytes            uint64 `json:"MemoryUsageCommitBytes,omitempty"`
	MemoryUsageCommitPeakBytes        uint64 `json:"MemoryUsageCommitPeakBytes,omitempty"`
	MemoryUsagePrivateWorkingSetBytes uint64 `json:"MemoryUsagePrivateWorkingSetBytes,omitempty"`
}

type Operation

type Operation = windows.Handle

func CreateOperation

func CreateOperation() (Operation, error)

CreateOperation creates a new operation.

type ProcessDetails

type ProcessDetails struct {
	ProcessId                    int32     `json:"ProcessId,omitempty"`
	ImageName                    string    `json:"ImageName,omitempty"`
	CreateTimestamp              time.Time `json:"CreateTimestamp,omitempty"`
	UserTime100ns                int32     `json:"UserTime100ns,omitempty"`
	KernelTime100ns              int32     `json:"KernelTime100ns,omitempty"`
	MemoryCommitBytes            int32     `json:"MemoryCommitBytes,omitempty"`
	MemoryWorkingSetPrivateBytes int32     `json:"MemoryWorkingSetPrivateBytes,omitempty"`
	MemoryWorkingSetSharedBytes  int32     `json:"MemoryWorkingSetSharedBytes,omitempty"`
}

type ProcessorStats

type ProcessorStats struct {
	TotalRuntime100ns  uint64 `json:"TotalRuntime100ns,omitempty"`
	RuntimeUser100ns   uint64 `json:"RuntimeUser100ns,omitempty"`
	RuntimeKernel100ns uint64 `json:"RuntimeKernel100ns,omitempty"`
}

type Properties

type Properties struct {
	ID          string           `json:"Id,omitempty"`
	SystemType  string           `json:"SystemType,omitempty"`
	Owner       string           `json:"Owner,omitempty"`
	State       string           `json:"State,omitempty"`
	Statistics  *Statistics      `json:"Statistics,omitempty"`
	ProcessList []ProcessDetails `json:"ProcessList,omitempty"`
}

func GetContainers

func GetContainers() ([]Properties, error)

type Statistics

type Statistics struct {
	Timestamp          time.Time       `json:"Timestamp,omitempty"`
	ContainerStartTime time.Time       `json:"ContainerStartTime,omitempty"`
	Uptime100ns        uint64          `json:"Uptime100ns,omitempty"`
	Processor          *ProcessorStats `json:"Processor,omitempty"`
	Memory             *MemoryStats    `json:"Memory,omitempty"`
	Storage            *StorageStats   `json:"Storage,omitempty"`
}

func GetContainerStatistics

func GetContainerStatistics(containerID string) (Statistics, error)

type StorageStats

type StorageStats struct {
	ReadCountNormalized  uint64 `json:"ReadCountNormalized,omitempty"`
	ReadSizeBytes        uint64 `json:"ReadSizeBytes,omitempty"`
	WriteCountNormalized uint64 `json:"WriteCountNormalized,omitempty"`
	WriteSizeBytes       uint64 `json:"WriteSizeBytes,omitempty"`
}

Jump to

Keyboard shortcuts

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