task

package
v0.0.0-...-44e44e7 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

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

func ValidStateTransitions

func ValidStateTransitions(src State, dst State) bool

Types

type Config

type Config struct {
	Name          string
	AttachStdin   bool
	AttachStdout  bool
	AttachStderr  bool
	ExposedPorts  nat.PortSet
	Cmd           []string
	Image         string
	Cpu           float64
	Memory        int64
	Disk          int64
	Env           []string
	RestartPolicy string
}

func NewConfig

func NewConfig(t *Task) *Config

type Docker

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

func NewDocker

func NewDocker(c *Config) *Docker

func (*Docker) Inspect

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

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 State

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

type Task

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

type TaskEvent

type TaskEvent struct {
	ID        uuid.UUID
	State     State
	Timestamp time.Time
	Task      Task
}

Jump to

Keyboard shortcuts

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