state

package
v1.12.19 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrunDir      = ".orun"
	PlansDir     = "plans"
	ExecDir      = "executions"
	LogsDir      = "logs"
	LatestName   = "latest"
	StateName    = "state.json"
	ManifestName = "manifest.json"
	MetadataName = "metadata.json"
)

Variables

This section is empty.

Functions

func GenerateExecID

func GenerateExecID(planName string) string

func LoadPlanFile

func LoadPlanFile(path string) (*model.Plan, error)

func PlanChecksumShort

func PlanChecksumShort(plan *model.Plan) string

Types

type ExecEntry

type ExecEntry struct {
	ID         string
	PlanName   string
	Status     string
	StartedAt  string
	FinishedAt string
	JobTotal   int
	JobDone    int
	JobFailed  int
}

type ExecMetadata

type ExecMetadata struct {
	ExecID     string          `json:"execId"`
	PlanID     string          `json:"planId"`
	PlanName   string          `json:"planName"`
	StartedAt  string          `json:"startedAt"`
	FinishedAt string          `json:"finishedAt,omitempty"`
	Status     string          `json:"status"`
	Trigger    string          `json:"trigger"`
	User       string          `json:"user"`
	DryRun     bool            `json:"dryRun"`
	JobTotal   int             `json:"jobTotal"`
	JobDone    int             `json:"jobDone"`
	JobFailed  int             `json:"jobFailed"`
	Links      []ExecutionLink `json:"links,omitempty"`
}

type ExecState

type ExecState struct {
	ExecID       string               `json:"execId"`
	PlanChecksum string               `json:"planChecksum"`
	Jobs         map[string]*JobState `json:"jobs"`
}

type ExecutionCounts

type ExecutionCounts struct {
	Total     int
	Completed int
	Failed    int
	Running   int
	Pending   int
}

func SummarizeExecutionState

func SummarizeExecutionState(st *ExecState) ExecutionCounts
type ExecutionLink struct {
	Label  string `json:"label"`
	URL    string `json:"url"`
	JobID  string `json:"jobId,omitempty"`
	StepID string `json:"stepId,omitempty"`
}

type JobState

type JobState struct {
	Status      string            `json:"status"`
	StartedAt   string            `json:"startedAt,omitempty"`
	FinishedAt  string            `json:"finishedAt,omitempty"`
	HeartbeatAt string            `json:"heartbeatAt,omitempty"`
	Steps       map[string]string `json:"steps"`
	LastError   string            `json:"lastError,omitempty"`
}

type PlanEntry

type PlanEntry struct {
	Name      string
	Path      string
	Checksum  string
	Jobs      int
	CreatedAt time.Time
}

type Store

type Store struct {
	BaseDir string
}

func NewStore

func NewStore(workDir string) *Store

func (*Store) CreateExecution

func (s *Store) CreateExecution(execID string, plan *model.Plan) (string, error)

func (*Store) EnsureDirs

func (s *Store) EnsureDirs() error

func (*Store) ExecDir

func (s *Store) ExecDir() string

func (*Store) ExecPath

func (s *Store) ExecPath(execID string) string

func (*Store) GC

func (s *Store) GC(maxCount int, maxAgeDays int, dryRun bool) ([]string, error)

func (*Store) ListExecutions

func (s *Store) ListExecutions() ([]ExecEntry, error)

func (*Store) ListPlans

func (s *Store) ListPlans() ([]PlanEntry, error)

func (*Store) LoadMetadata

func (s *Store) LoadMetadata(execID string) (*ExecMetadata, error)

func (*Store) LoadState

func (s *Store) LoadState(execID string) (*ExecState, error)

func (*Store) LogDir

func (s *Store) LogDir(execID, jobID string) string

func (*Store) LogPath

func (s *Store) LogPath(execID, jobID, stepID string) string

func (*Store) MetadataPath

func (s *Store) MetadataPath(execID string) string

func (*Store) MigrateLegacyState

func (s *Store) MigrateLegacyState(workDir string) (bool, error)

func (*Store) PlanDir

func (s *Store) PlanDir() string

func (*Store) ResolveExecID

func (s *Store) ResolveExecID(ref string) (string, error)

func (*Store) ResolvePlanRef

func (s *Store) ResolvePlanRef(ref string) (string, error)

func (*Store) SaveMetadata

func (s *Store) SaveMetadata(execID string, meta *ExecMetadata) error

func (*Store) SavePlan

func (s *Store) SavePlan(plan *model.Plan, name string) error

func (*Store) SaveState

func (s *Store) SaveState(execID string, st *ExecState) error

func (*Store) StatePath

func (s *Store) StatePath(execID string) string

Jump to

Keyboard shortcuts

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