ship: v0.1 Foundation milestone complete (#1)
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type JobStatus string
|
||||
|
||||
const (
|
||||
JobStatusPending JobStatus = "pending"
|
||||
JobStatusRunning JobStatus = "running"
|
||||
JobStatusComplete JobStatus = "complete"
|
||||
JobStatusFailed JobStatus = "failed"
|
||||
JobStatusStopped JobStatus = "stopped"
|
||||
)
|
||||
|
||||
type Job struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Spec string `json:"spec"`
|
||||
Status JobStatus `json:"status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
StartedAt *time.Time `json:"started_at,omitempty"`
|
||||
EndedAt *time.Time `json:"ended_at,omitempty"`
|
||||
ExitCode int `json:"exit_code"`
|
||||
}
|
||||
|
||||
type TaskStatus string
|
||||
|
||||
const (
|
||||
TaskStatusPending TaskStatus = "pending"
|
||||
TaskStatusRunning TaskStatus = "running"
|
||||
TaskStatusComplete TaskStatus = "complete"
|
||||
TaskStatusFailed TaskStatus = "failed"
|
||||
TaskStatusKilled TaskStatus = "killed"
|
||||
)
|
||||
|
||||
type Task struct {
|
||||
ID string `json:"id"`
|
||||
JobID string `json:"job_id"`
|
||||
Command string `json:"command"`
|
||||
Args []string `json:"args"`
|
||||
Env []string `json:"env,omitempty"`
|
||||
PID int `json:"pid"`
|
||||
ExitCode int `json:"exit_code"`
|
||||
Status TaskStatus `json:"status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
StartedAt *time.Time `json:"started_at,omitempty"`
|
||||
EndedAt *time.Time `json:"ended_at,omitempty"`
|
||||
Stdout string `json:"stdout,omitempty"`
|
||||
Stderr string `json:"stderr,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type NodeState string
|
||||
|
||||
const (
|
||||
NodeStatePending NodeState = "pending"
|
||||
NodeStateReady NodeState = "ready"
|
||||
NodeStateLeft NodeState = "left"
|
||||
)
|
||||
|
||||
type Node struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Address string `json:"address"`
|
||||
State NodeState `json:"state"`
|
||||
JoinedAt time.Time `json:"joined_at"`
|
||||
LastSeen time.Time `json:"last_seen"`
|
||||
Metadata map[string]string `json:"metadata,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user