state

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package state owns ggvalet's transactional operational state.

Index

Constants

View Source
const (
	StatusPending   = "pending"
	StatusRunning   = "running"
	StatusSucceeded = "succeeded"
	StatusFailed    = "failed"
	StatusBlocked   = "blocked"
	StatusUncertain = "uncertain"
)

Variables

This section is empty.

Functions

func Digest

func Digest(v any) string

Types

type Operation

type Operation struct {
	Provider, Host, Action, Resource, Target, InputDigest string
}

type PlanRun

type PlanRun struct {
	ID, TargetKey, Provider, PlanJSON, Status, Error string
	CreatedAt, UpdatedAt                             time.Time
}

type PlanStep

type PlanStep struct {
	RunID, StepID, Kind, Status, WebURL, Error string
	RemoteID, RemoteIID                        int
	UpdatedAt                                  time.Time
}

type Receipt

type Receipt struct {
	ID, OperationID, Phase, Provider, Host, Action, Resource, Target string
	Status, Detail, InputDigest                                      string
	OccurredAt                                                       time.Time
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func Open

func Open(path string) (*Store, error)

func (*Store) Begin

func (s *Store) Begin(ctx context.Context, op Operation) (string, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Complete

func (s *Store) Complete(ctx context.Context, id, status, detail string) error

func (*Store) ExportJSONL

func (s *Store) ExportJSONL(ctx context.Context, w io.Writer) error

func (*Store) ImportLegacy

func (s *Store) ImportLegacy(ctx context.Context, path string) error

func (*Store) Receipts

func (s *Store) Receipts(ctx context.Context) ([]Receipt, error)

func (*Store) Run

func (s *Store) Run(ctx context.Context, id string) (PlanRun, []PlanStep, error)

func (*Store) SetRunStatus

func (s *Store) SetRunStatus(ctx context.Context, id, status, detail string) error

func (*Store) SetStep

func (s *Store) SetStep(ctx context.Context, runID, stepID, status string, remoteID, remoteIID int, webURL, detail string) error

func (*Store) StartRun

func (s *Store) StartRun(ctx context.Context, targetKey, provider string, planJSON []byte, steps []PlanStep) (string, error)

Jump to

Keyboard shortcuts

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