types

package
v0.0.0-...-b89aff2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MachineStatePending     MachineState = "pending"
	MachineStateStarting    MachineState = "starting"
	MachineStateRunning     MachineState = "running"
	MachineStateDegraded    MachineState = "degraded"
	MachineStateError       MachineState = "error"
	MachineStateTerminating MachineState = "terminating"
	MachineStateTerminated  MachineState = "terminated"

	MachineDesiredStatePending    MachineDesiredState = "pending"
	MachineDesiredStateRunning    MachineDesiredState = "running"
	MachineDesiredStateTerminated MachineDesiredState = "terminated"
)

Variables

View Source
var ErrMachineNotFound = errors.New("machine not found")
View Source
var ErrNetworkInterfaceNotFound = errors.New("network interface not found")

Functions

This section is empty.

Types

type GormNetIPNet

type GormNetIPNet net.IPNet

func (*GormNetIPNet) GormDataType

func (*GormNetIPNet) GormDataType() string

func (*GormNetIPNet) Scan

func (v *GormNetIPNet) Scan(value interface{}) error

func (*GormNetIPNet) Value

func (v *GormNetIPNet) Value() (driver.Value, error)

type Machine

type Machine struct {
	ID               string `gorm:"primaryKey"`
	State            MachineState
	DesiredState     MachineDesiredState
	RuntimePID       *int `gorm:"column:runtime_pid"`
	Spec             *MachineSpec
	Volume           *Volume
	NetworkInterface *NetworkInterface
	CreatedAt        time.Time
	TerminatedAt     *time.Time
}

type MachineDesiredState

type MachineDesiredState string

type MachineSpec

type MachineSpec struct {
	Image      string
	Cpus       uint32
	MemoryMB   uint64
	Env        map[string]string
	User       string
	WorkingDir string
	Command    []string
}

func (*MachineSpec) GormDataType

func (*MachineSpec) GormDataType() string

func (*MachineSpec) Scan

func (s *MachineSpec) Scan(value interface{}) error

func (*MachineSpec) Value

func (s *MachineSpec) Value() (driver.Value, error)

type MachineState

type MachineState string

func (MachineState) MatchDesiredState

func (s MachineState) MatchDesiredState(desired MachineDesiredState) bool

type NetworkInterface

type NetworkInterface struct {
	ID             string `gorm:"primaryKey"`
	Name           string
	MachineID      *string
	IPAddress      net.IP           `gorm:"type:text"`
	MacAddress     net.HardwareAddr `gorm:"type:text"`
	GatewayAddress net.IP           `gorm:"type:text"`
	NetworkCIDR    *GormNetIPNet    `gorm:"column:network_cidr"`
	CreatedAt      time.Time
	DeletedAt      *time.Time
}

type NetworkProvider

type NetworkProvider interface {
	GetInterface(name string) (*NetworkInterface, error)

	AllocateInterface(ctx context.Context) (*NetworkInterface, error)

	ReleaseInterface(ctx context.Context, name string) error
}

type NodeCreateMachineOptions

type NodeCreateMachineOptions struct {
	MachineID    string
	DesiredState MachineDesiredState
	Spec         MachineSpec
}

type NodeServerConfig

type NodeServerConfig struct {
	ClusterID             string
	BootstrapToken        string
	IPAddr                string
	APIAddr               string
	GatewayAddr           string
	StorageDirectory      string
	InitBinary            string
	VMLinux               string
	CloudHypervisorBinary string
}

type NodeService

type NodeService interface {
	Start(ctx context.Context) error

	Stop(ctx context.Context) error

	AuthorityCertificate() *x509.Certificate

	TLSCertificate() *tls.Certificate

	ListMachines(ctx context.Context) ([]*Machine, error)

	FindMachine(ctx context.Context, machineID string) (*Machine, error)

	CreateMachine(ctx context.Context, opts NodeCreateMachineOptions) (*Machine, error)

	UpdateMachineDesiredState(ctx context.Context, opts NodeUpdateMachineDesiredStateOptions) (*Machine, error)
}

type NodeUpdateMachineDesiredStateOptions

type NodeUpdateMachineDesiredStateOptions struct {
	MachineID    string
	DesiredState MachineDesiredState
}

type RuntimeCreateOptions

type RuntimeCreateOptions struct {
	MachineID        string
	Spec             MachineSpec
	Volume           Volume
	NetworkInterface NetworkInterface
}

type RuntimeProvider

type RuntimeProvider interface {
	GC(ctx context.Context, getExpectedMachineIDs func() []string) error

	Create(ctx context.Context, opts RuntimeCreateOptions) (int, error)

	Boot(ctx context.Context, machineID string) error

	Terminate(ctx context.Context, machineID string) error

	Healthcheck(ctx context.Context, machineID string) error
}

type Volume

type Volume struct {
	ID        string `gorm:"primaryKey"`
	MachineID *string
	Path      string
	ReadOnly  bool
	Size      uint64
	CreatedAt time.Time
	DeletedAt *time.Time
}

type VolumeProvider

type VolumeProvider interface {
	CreateVolume(ctx context.Context, image v1.Image) (*Volume, error)

	DeleteVolume(ctx context.Context, volume *Volume) error
}

Jump to

Keyboard shortcuts

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