types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventNameInstancesChange = "change"

	EventNameInstanceStatusChange = "status_change"
	EventNameInstanceStdout       = "stdout"
	EventNameInstanceStderr       = "stderr"
)
View Source
const (
	InstanceStatusOff      = "off"
	InstanceStatusBuilding = "building"
	InstanceStatusStarting = "starting"
	InstanceStatusRunning  = "running"
	InstanceStatusError    = "error"
)
View Source
const (
	LogKindOut       = "out"
	LogKindErr       = "err"
	LogKindVertexOut = "vertex_out"
	LogKindVertexErr = "vertex_err"
)
View Source
const (
	PmNone   = "sources"
	PmAptGet = "apt-get"
	PmBrew   = "brew"
	PmPacman = "pacman"
	PmSnap   = "snap"
)
View Source
const (
	URLKindClient = "client"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency interface {
	// CheckForUpdate will check if the dependency has an update available. If
	// true, it returns the Update, or nil otherwise.
	CheckForUpdate() (*Update, error)

	// InstallUpdate will install the previously fetched update.
	InstallUpdate() error

	// GetID returns the ID of the dependency that can be used to
	// identify it from the client.
	GetID() string
}

Dependency describes main vertex programs that Vertex needs to run, like Vertex, Vertex Services, Vertex Web UI...

type EnvVariable

type EnvVariable struct {
	Type        string `json:"type"`
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Secret      bool   `json:"secret,omitempty"`
	Default     string `json:"default,omitempty"`
	Description string `json:"description"`
}

type EnvVariables

type EnvVariables map[string]string

type EventInstanceLog added in v0.1.1

type EventInstanceLog struct {
	InstanceUUID uuid.UUID
	Kind         string
	Message      string
}

type EventInstanceStatusChange added in v0.1.1

type EventInstanceStatusChange struct {
	InstanceUUID uuid.UUID
	Status       string
}

type EventInstancesChange added in v0.1.1

type EventInstancesChange struct{}

type EventRepository added in v0.1.1

type EventRepository interface {
	AddListener(l Listener)
	RemoveListener(l Listener)
	Send(e interface{})
}

type Instance

type Instance struct {
	Service
	InstanceMetadata

	UUID         uuid.UUID    `json:"uuid"`
	Status       string       `json:"status"`
	EnvVariables EnvVariables `json:"env"`
}

func NewInstance added in v0.1.1

func NewInstance(id uuid.UUID, service Service) Instance

func (*Instance) DockerContainerName

func (i *Instance) DockerContainerName() string

func (*Instance) DockerImageName

func (i *Instance) DockerImageName() string

func (*Instance) IsDockerized added in v0.1.1

func (i *Instance) IsDockerized() bool

func (*Instance) IsRunning

func (i *Instance) IsRunning() bool

type InstanceLogsRepository added in v0.1.1

type InstanceLogsRepository interface {
	Open(uuid uuid.UUID) error
	Close(uuid uuid.UUID) error
	Push(uuid uuid.UUID, line LogLine)

	// LoadBuffer will load the latest logs kept in memory.
	LoadBuffer(uuid uuid.UUID) ([]LogLine, error)

	CloseAll() error
}

type InstanceMetadata

type InstanceMetadata struct {
	// UseDocker indicates if the instance should be launched with Docker.
	// The default value is false.
	UseDocker *bool `json:"use_docker,omitempty"`

	// UseReleases indicates if the instance should use precompiled releases when possible.
	// The default value is false.
	UseReleases *bool `json:"use_releases,omitempty"`

	// LaunchOnStartup indicates if the instance needs to start automatically when Vertex starts.
	// The default value is true.
	LaunchOnStartup *bool `json:"launch_on_startup,omitempty"`
}

type InstanceRepository

type InstanceRepository interface {
	Get(uuid uuid.UUID) (*Instance, error)
	GetAll() map[uuid.UUID]*Instance
	GetPath(uuid uuid.UUID) string
	Delete(uuid uuid.UUID) error
	Exists(uuid uuid.UUID) bool
	Set(uuid uuid.UUID, instance Instance) error

	SaveMetadata(i *Instance) error
	LoadMetadata(i *Instance) error

	SaveEnv(i *Instance, variables map[string]string) error
	LoadEnv(i *Instance) error

	ReadService(instancePath string) (Service, error)

	Reload(func(uuid uuid.UUID))
}

type Listener added in v0.1.1

type Listener interface {
	OnEvent(e interface{})
	GetUUID() uuid.UUID
}

type LogLine

type LogLine struct {
	Id      int    `json:"id"`
	Kind    string `json:"kind"`
	Message string `json:"message"`
}

type Package

type Package struct {
	Name           string            `json:"name"`
	Description    string            `json:"description"`
	Homepage       string            `json:"homepage"`
	License        string            `json:"license"`
	Check          string            `json:"check"`
	InstallPackage map[string]string `json:"install"`
	Installed      *bool             `json:"installed,omitempty"`
}

type PackageRepository

type PackageRepository interface {
	Get(id string) (Package, error)
	GetPath(id string) string
}

type RunnerRepository added in v0.1.1

type RunnerRepository interface {
	Delete(instance *Instance) error
	Start(instance *Instance, onLog func(msg string), onErr func(msg string), setStatus func(status string)) error
	Stop(instance *Instance) error
	Info(instance Instance) (map[string]any, error)
}

type Service

type Service struct {
	ID   string `json:"id"`
	Name string `json:"name"`

	// Repository describes where to find the service.
	// - Example for GitHub: github.com/vertex-center/vertex-spotify
	// - Example for LocalStorage: localstorage:/Users/username/service
	Repository     string         `json:"repository"`
	Description    string         `json:"description"`
	EnvDefinitions []EnvVariable  `json:"environment,omitempty"`
	URLs           []URL          `json:"urls,omitempty"`
	Methods        ServiceMethods `json:"methods"`
}

type ServiceMethodDocker added in v0.1.1

type ServiceMethodDocker struct {
	Image      *string            `json:"image,omitempty"`
	Dockerfile *string            `json:"dockerfile,omitempty"`
	Ports      *[]string          `json:"ports,omitempty"`
	Volumes    *map[string]string `json:"volumes,omitempty"`
}

type ServiceMethodScript added in v0.1.1

type ServiceMethodScript struct {
	Filename     string           `json:"file"`
	Dependencies *map[string]bool `json:"dependencies,omitempty"`
}

type ServiceMethods added in v0.1.1

type ServiceMethods struct {
	Script *ServiceMethodScript `json:"script,omitempty"`
	Docker *ServiceMethodDocker `json:"docker,omitempty"`
}

type ServiceRepository

type ServiceRepository interface {
	GetAll() []Service
}

type TempListener added in v0.1.1

type TempListener struct {
	// contains filtered or unexported fields
}

func NewTempListener added in v0.1.1

func NewTempListener(onEvent func(e interface{})) TempListener

func (TempListener) GetUUID added in v0.1.1

func (t TempListener) GetUUID() uuid.UUID

func (TempListener) OnEvent added in v0.1.1

func (t TempListener) OnEvent(e interface{})

type URL added in v0.1.1

type URL struct {
	Name      string  `json:"name"`
	Port      string  `json:"port"`
	PingRoute *string `json:"ping,omitempty"`
	Kind      string  `json:"kind"`
}

type Update

type Update struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	CurrentVersion string `json:"current_version"`
	LatestVersion  string `json:"latest_version"`
	NeedsRestart   bool   `json:"needs_restart"`
}

type Updates

type Updates struct {
	LastChecked *time.Time `json:"last_checked"`
	Items       []Update   `json:"items"`
}

Jump to

Keyboard shortcuts

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