state

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeAndSave added in v0.2.0

func MergeAndSave(config config.Config, newState *State) error

func MergeStates

func MergeStates(existingState, newState *State)

Types

type Job added in v0.2.0

type Job struct {
	Name        string    `json:"name"`
	ID          int64     `json:"id"`
	StartedAt   int64     `json:"started_at"` // Unix timestamp
	CompletedAt int64     `json:"completed_at"`
	UpdatedAt   int64     `json:"updated_at"`
	Status      JobStatus `json:"status"`
	Delete      bool
	Droplet     do.Droplet `json:"droplet"`
}

type JobStatus

type JobStatus string
const (
	Provisioning JobStatus = "provisioning"
	Running      JobStatus = "running"
	Completed    JobStatus = "completed"
	Failed       JobStatus = "failed"
	Cancelled    JobStatus = "cancelled"
	Timedout     JobStatus = "timedout"
)

type State

type State struct {
	Jobs []Job `json:"jobs"`
}

func GetState

func GetState(config config.Config) (*State, error)

func (*State) CancelRunningJob added in v0.2.0

func (s *State) CancelRunningJob(config config.Config, jobID int64) error

func (*State) CreateJob

func (s *State) CreateJob(job Job)

CreateJob adds a new job to the state.

func (*State) GetJob

func (s *State) GetJob(jobID int64) *Job

GetJob returns a job with the specified ID or nil if not found.

func (*State) GetLatestCompletedJob added in v0.2.0

func (s *State) GetLatestCompletedJob() (*Job, error)

func (*State) GetLatestJob

func (s *State) GetLatestJob() *Job

GetLatestJob returns the latest job in the state.

Jump to

Keyboard shortcuts

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