cluster

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	// PutMachine confirm an allocation placed before on the agent
	// It returns the machine instance created on the agent
	// The agent should then create an instance of the machine and start it
	// if the start flag is set to true
	PutMachine(ctx context.Context, opt PutMachineOptions) (*MachineInstance, error)
	StartMachine(ctx context.Context, machineId string) error
	StopMachine(ctx context.Context, machineId string, opt *api.StopConfig) error
	MachineExec(ctx context.Context, machineId string, cmd []string, timeout time.Duration) (*api.ExecResult, error)
	DestroyMachine(ctx context.Context, machineId string, force bool) error
	SubscribeToMachineLogs(ctx context.Context, id string) ([]*api.LogEntry, <-chan *api.LogEntry, error)
	GetMachineLogs(ctx context.Context, id string) ([]*api.LogEntry, error)
	WaitForMachineStatus(ctx context.Context, id string, status api.MachineStatus, timeout uint) error

	EnableMachineGateway(ctx context.Context, id string) error
	DisableMachineGateway(ctx context.Context, id string) error
}

type ClusterState

type ClusterState interface {
	Queries
	BeginTx(ctx context.Context) (TX, error)
}

type Machine

type Machine struct {
	Id             string     `json:"id"`
	Namespace      string     `json:"namespace"`
	FleetId        string     `json:"fleet_id"`
	InstanceId     string     `json:"instance_id"`
	MachineVersion string     `json:"machine_version"`
	Node           string     `json:"node"`
	Region         string     `json:"region"`
	CreatedAt      time.Time  `json:"created_at"`
	UpdatedAt      time.Time  `json:"updated_at"`
	DestroyedAt    *time.Time `json:"destroyed_at"`
}

type MachineInstance

type MachineInstance struct {
	Id                   string             `json:"id"`
	Node                 string             `json:"node"`
	Namespace            string             `json:"namespace"`
	MachineId            string             `json:"machine_id"`
	MachineVersion       string             `json:"machine_version"`
	Status               api.MachineStatus  `json:"status"`
	Events               []api.MachineEvent `json:"events"`
	LocalIPV4            string             `json:"local_ipv4"`
	CreatedAt            time.Time          `json:"created_at"`
	UpdatedAt            time.Time          `json:"updated_at"`
	EnableMachineGateway bool               `json:"enable_machine_gateway"`
}

type PutMachineOptions

type PutMachineOptions struct {
	Machine       Machine            `json:"machine"`
	Version       api.MachineVersion `json:"version"`
	AllocationId  string             `json:"allocation_id"`
	Start         bool               `json:"start"`
	EnableGateway bool               `json:"enable_gateway"`
}

type Queries added in v0.4.0

type Queries interface {

	/* Used by the API server */
	CreateGateway(ctx context.Context, gateway api.Gateway) error
	DeleteGateway(ctx context.Context, id string) error
	DeleteFleetGateways(ctx context.Context, fleetId string) error

	CreateMachineVersion(ctx context.Context, mv api.MachineVersion) error
	CreateMachine(ctx context.Context, m Machine, mv api.MachineVersion) error
	UpdateMachine(ctx context.Context, m Machine) error
	DestroyMachine(ctx context.Context, id string) error

	ListAPIMachines(ctx context.Context, namespace string, fleetId string, includeDestroyed bool) ([]api.Machine, error)
	GetAPIMachine(ctx context.Context, namespace string, fleetId string, machineId string) (*api.Machine, error)
	DestroyNamespaceData(ctx context.Context, namespace string) error

	GetNode(ctx context.Context, id string) (api.Node, error)
	ListNodesInRegion(ctx context.Context, region string) ([]api.Node, error)
	ListNodes(ctx context.Context) ([]api.Node, error)

	/* Used by raveld */
	UpsertNode(ctx context.Context, node api.Node) error
	UpsertInstance(ctx context.Context, i MachineInstance) error
}

type TX added in v0.4.0

type TX interface {
	Queries
	Commit(context.Context) error
	Rollback(context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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