sail

package
v0.0.0-...-cdb8e5e Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Analogical to Task

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(states []State, state State) bool

func ValidStateTransition

func ValidStateTransition(src State, dst State) bool

Types

type Config

type Config struct {
	// Name of the task, also used as the container name
	Name string
	// AttachStdin boolean which determines if stdin should be attached
	AttachStdin bool
	// AttachStdout boolean which determines if stdout should be attached
	AttachStdout bool
	// AttachStderr boolean which determines if stderr should be attached
	AttachStderr bool
	// ExposedPorts list of ports exposed
	ExposedPorts nat.PortSet
	// Cmd to be run inside container (optional)
	Cmd []string
	// Image used to run the container
	Image string
	// Cpu
	Cpu float64
	// Memory in MiB
	Memory int64
	// Disk in GiB
	Disk int64
	// Env variables
	Env []string
	// RestartPolicy for the container ["", "always", "unless-stopped", "on-failure"]
	RestartPolicy string
}

func NewConfig

func NewConfig(t *Sail) *Config

type Docker

type Docker struct {
	Client *client.Client
	Config Config
}

func NewDocker

func NewDocker(c *Config) *Docker

func (*Docker) Inspect

func (d *Docker) Inspect(containerID string) DockerInspectResponse

func (*Docker) Remove

func (d *Docker) Remove(id string) DockerResult

func (*Docker) Run

func (d *Docker) Run() DockerResult

func (*Docker) Stop

func (d *Docker) Stop(id string) DockerResult

type DockerInspectResponse

type DockerInspectResponse struct {
	Error     error
	Container *types.ContainerJSON
}

type DockerResult

type DockerResult struct {
	Error       error
	Action      string
	ContainerId string
	Result      string
}

type Sail

type Sail struct {
	ID            uuid.UUID
	ContainerID   string
	Name          string
	State         State
	Image         string
	Cpu           float64
	Memory        int64
	Disk          int64
	ExposedPorts  nat.PortSet
	HostPorts     nat.PortMap
	PortBindings  map[string]string
	RestartPolicy string
	StartTime     time.Time
	FinishTime    time.Time
	HealthCheck   string
	RestartCount  int
}

type SailEvent

type SailEvent struct {
	ID        uuid.UUID
	State     State
	Timestamp time.Time
	Sail      Sail
}

type State

type State int
const (
	Pending State = iota
	Scheduled
	Running
	Completed
	Failed
)

func (State) String

func (s State) String() []string

Jump to

Keyboard shortcuts

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