operation

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package operation provides the durable read model shared by asynchronous ConfigOps workflows. It intentionally stores only progress and resource references; workflow-specific input remains with its owning use case.

Index

Constants

This section is empty.

Variables

View Source
var AllowedStages = map[string]map[string]bool{
	"remote_pull":      {"queued": true, "reading_remote": true, "snapshotting": true, "completed": true},
	"remote_validate":  {"queued": true, "validating_remote": true, "completed": true},
	"plan":             {"queued": true, "reading_remote": true, "compiling": true, "analyzing": true, "completed": true},
	"release":          {"queued": true, "validating_remote": true, "submitting": true, "verifying": true, "recording_audit": true, "completed": true},
	"publish":          {"queued": true, "validating_remote": true, "submitting": true, "verifying": true, "recording_audit": true, "completed": true},
	"rollback_preview": {"queued": true, "reading_remote": true, "analyzing": true, "completed": true},
	"rollback":         {"queued": true, "validating_remote": true, "submitting": true, "verifying": true, "recording_audit": true, "completed": true},
}

AllowedStages freezes the Spec 009 workflow boundaries. Other operation types remain extensible for later Specs, while read workflows cannot be accidentally routed through a publishing stage.

View Source
var ErrInvalidStage = errors.New("operation stage is invalid for operation type")
View Source
var ErrNotFound = errors.New("operation not found")

Functions

This section is empty.

Types

type Failure

type Failure struct {
	Code      string `json:"code"`
	Message   string `json:"message"`
	Retryable bool   `json:"retryable"`
	Stage     string `json:"stage"`
}

type Operation

type Operation struct {
	OperationID   string    `json:"operation_id"`
	OperationType string    `json:"operation_type"`
	Status        string    `json:"status"`
	Stage         string    `json:"stage"`
	RemoteState   string    `json:"remote_state"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
	Failure       *Failure  `json:"failure,omitempty"`
	Result        *Result   `json:"result,omitempty"`
}

type Result

type Result struct {
	ResourceType string `json:"resource_type"`
	ResourceID   string `json:"resource_id"`
	Href         string `json:"href"`
}

type Store

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

func Open

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

func (*Store) Create

func (s *Store) Create(operationType string) (Operation, error)

func (*Store) Get

func (s *Store) Get(id string) (Operation, error)

func (*Store) Update

func (s *Store) Update(id, status, stage string, failure *Failure, result *Result, remoteState string) (Operation, error)

Jump to

Keyboard shortcuts

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