services

package
v0.0.0-...-b39efbf Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyExists = errors.New("already exists")
	ErrNotFound      = errors.New("not found")
)

Functions

This section is empty.

Types

type HostReinstall

type HostReinstall struct {
	ID            uuid.UUID `json:"id"`
	LocalNodePath string    `json:"local_node_path"`
}

type Hosts

type Hosts interface {
	Validate(ctx context.Context, host NewHost) error
	HostByID(ctx context.Context, id uuid.UUID) (model.Host, error)
	ListHosts(ctx context.Context) ([]model.Host, error)
	AddHost(ctx context.Context, host *NewHost) (uuid.UUID, error)
	UpdateHostStatus(ctx context.Context, host *model.Host, status model.Status) error
	InstallHost(ctx context.Context, h *model.Host, localNodePath string)
	ActivateHost(ctx context.Context, h *model.Host)
	GetConnManager(ctx context.Context) *rpc.GRPCConnection
	InitializeHosts(ctx context.Context) []error

	// TODO consider making private
	FindHostUP(ctx context.Context) *model.Host
}

func NewHostsService

func NewHostsService(hr repositories.Hosts, log *logrus.Logger, connManager *rpc.GRPCConnection) Hosts

type NewHost

type NewHost struct {
	Name          string `json:"name"`
	Address       string `json:"address"`
	User          string `json:"user"`
	Password      string `json:"password"`
	LocalNodePath string `json:"local_node_path"`
	ShouldInstall bool   `json:"-"`
	Port          int    `json:"port"`
}

type NewVM

type NewVM struct {
	Name           string `json:"name"`
	VCPU           int64  `json:"vcpu"`
	Memory         int64  `json:"memory"`
	Kernel         string `json:"kernel"`
	RootFileSystem string `json:"rootfs"`
}

type VMs

type VMs interface {
	AddVM(ctx context.Context, vm NewVM) (uuid.UUID, error)
	StartVM(ctx context.Context, id uuid.UUID) (*model.VM, error)
	ListVms(ctx context.Context) ([]model.VM, error)
	ListVmsForHost(ctx context.Context, hostID uuid.UUID) ([]model.VM, error)
	StopVM(ctx context.Context, vm *model.VM) (uuid.UUID, error)
	UpdateVMStatus(ctx context.Context, vm *model.VM, status model.Status) error
	VMByID(ctx context.Context, vmID uuid.UUID) (model.VM, error)
}

func NewVMsService

func NewVMsService(vr repositories.VMs, hs Hosts, logger *logger.Logger) VMs

NewVMsService instantiates a new VM service

type VolumeReq

type VolumeReq struct {
	ImageName   string `json:"image"`
	Description string `json:"description"`
}

type Volumes

type Volumes interface {
	AddVolume(ctx context.Context, volume VolumeReq) (uuid.UUID, error)
}

func NewVolumesService

func NewVolumesService(hs Hosts, s storage.Service, vr repositories.Volumes, logger *log.Logger) Volumes

Jump to

Keyboard shortcuts

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