entity

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const PlanKindCommand = "command"

PlanKindCommand runs a command: its Task.Params is a CommandParams, the planner builds its Task.Job, and every run of it is reported with PlanRunStarted and PlanRunFinished.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandParams added in v0.7.0

type CommandParams struct {
	Command []string          `json:"command"` // argv, the executable first
	Dir     string            `json:"dir,omitempty"`
	Env     map[string]string `json:"env,omitempty"` // on top of the process environment
}

type Plan added in v0.4.0

type Plan struct {
	ID          string     `json:"id"`
	Metadata    labels.Set `json:"metadata"`
	Description string     `json:"description"`
	Kind        string     `json:"kind,omitempty"` // a predefined kind, or empty for a Task with its own Job
	Task        *task.Task `json:"task"`
}

type PlanRun added in v0.7.0

type PlanRun struct {
	ID         string        `json:"id"`
	PlanID     string        `json:"plan_id"`
	Source     PlanRunSource `json:"source"`
	State      PlanRunState  `json:"state"`
	StartedAt  time.Time     `json:"started_at"`
	EndedAt    time.Time     `json:"ended_at,omitzero"`
	ExitCode   int           `json:"exit_code"`
	OutputTail string        `json:"output_tail,omitempty"`
	LogPath    string        `json:"log_path,omitempty"`
	Error      string        `json:"error,omitempty"`
}

PlanRun is one run of a plan of a predefined kind, as of when it was reported. A retry or a requeue is a new run. LastRun returns the plan's latest one.

type PlanRunFinished added in v0.7.0

type PlanRunFinished struct {
	PlanRun
}

PlanRunFinished is sent through the planner's MessageSender as a run ends.

func (PlanRunFinished) Kind added in v0.7.0

func (PlanRunFinished) Kind() string

type PlanRunSource added in v0.7.0

type PlanRunSource string

PlanRunSource says who started a run; a caller of Trigger may define values of its own.

const (
	PlanRunSchedule PlanRunSource = "schedule"
	PlanRunManual   PlanRunSource = "manual"
)

type PlanRunStarted added in v0.7.0

type PlanRunStarted struct {
	PlanRun
}

PlanRunStarted is sent through the planner's MessageSender as a run starts.

func (PlanRunStarted) Kind added in v0.7.0

func (PlanRunStarted) Kind() string

type PlanRunState added in v0.7.0

type PlanRunState string
const (
	PlanRunRunning   PlanRunState = "running"
	PlanRunSucceeded PlanRunState = "succeeded"
	PlanRunFailed    PlanRunState = "failed"
	PlanRunCanceled  PlanRunState = "canceled"
)

type PlannerStats

type PlannerStats struct {
	ID            string        `json:"id"`
	Schedule      string        `json:"schedule"`
	State         string        `json:"state"`
	Progress      float64       `json:"progress"`
	StartedAt     time.Time     `json:"started_at"`
	ExecutionTime time.Duration `json:"execution_time"`
	Cooldown      time.Duration `json:"cooldown"`
	Retries       uint          `json:"retries"`
	Labels        labels.Set    `json:"labels"`
	Error         string        `json:"error"`
}

type PlannerStatsOptions

type PlannerStatsOptions struct {
	Selector string `json:"selector,omitempty"`
	All      bool   `json:"all"`
}

type PubsubMessage

type PubsubMessage struct {
	From    string `json:"from"`
	Topic   string `json:"topic"`
	Kind    string `json:"kind"`
	Payload any    `json:"payload"`
}

PubsubMessage represents an event delivered through a subscription channel.

type SupervisorInitPolicy added in v0.6.9

type SupervisorInitPolicy struct {
	MaxRetries int
	Delay      time.Duration
	MaxDelay   time.Duration
}

SupervisorInitPolicy shapes how a service's init turn retries: MaxRetries bounds the attempts (0 one pass, -1 until ctx cancels), Delay is the backoff base, doubling up to MaxDelay.

type SupervisorMonitorPolicy added in v0.6.9

type SupervisorMonitorPolicy struct {
	Interval     time.Duration
	MaxRetries   int
	RestartDelay time.Duration
}

SupervisorMonitorPolicy shapes the health monitor: Interval is the sweep cadence (0 disables monitoring), MaxRetries bounds in-process restarts per service (0 none - a liveness failure escalates immediately, -1 unlimited), RestartDelay pauses before each restart attempt.

type SupervisorStats added in v0.4.0

type SupervisorStats struct {
	Name              string
	Initialized       bool
	InitializedAt     time.Time
	InitializationErr error
	Started           bool
	StartedAt         time.Time
	StartErr          error
	Stopped           bool
	StoppedAt         time.Time
	StopErr           error
	HealthcheckedAt   time.Time
	HealthcheckErr    error
	LivenessErr       error
	Ready             bool
	ReadinessErr      error
	Restarts          int
	RestartedAt       time.Time
	InitDuration      time.Duration
	StartDuration     time.Duration
	StopDuration      time.Duration
	Source            common.Service
}

func (*SupervisorStats) Healthcheck added in v0.4.0

func (s *SupervisorStats) Healthcheck() error

func (*SupervisorStats) Uptime added in v0.4.0

func (s *SupervisorStats) Uptime() time.Duration

type SupervisorStopPolicy added in v0.6.9

type SupervisorStopPolicy struct {
	Timeout time.Duration
}

SupervisorStopPolicy shapes how a shutdown ends: Timeout bounds the whole stop, and the stop of each restart, after which what is left is forced; 0 leaves the bound to the caller's context.

Jump to

Keyboard shortcuts

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