Help us shape the future of Go! Take the 2026 Go Developer Survey

execution

package
v3.0.36 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindSync              = "sync"
	KindOperation         = "operation"
	KindSubscription      = "subscription"
	StatusRunning         = "running"
	StatusCancelRequested = "cancel_requested"
	StatusCompleted       = "completed"
	StatusCanceled        = "canceled"
	StatusFailed          = "failed"
	StatusOrphaned        = "orphaned"
	EventProgress         = "progress"
	EventData             = "data"
	EventDiagnostic       = "diagnostic"
	EventTerminal         = "terminal"
)

Variables

View Source
var (
	ErrSequenceConflict  = errors.New("execution event sequence conflict")
	ErrInvalidTransition = errors.New("execution state transition is invalid")
	ErrNotCancelable     = errors.New("execution is not cancelable")
	ErrTerminal          = errors.New("execution is terminal")
)

Functions

This section is empty.

Types

type Event

type Event struct {
	ExecutionID string         `json:"execution_id"`
	Sequence    uint64         `json:"sequence"`
	Kind        string         `json:"kind"`
	Payload     map[string]any `json:"payload,omitempty"`
	Error       *PublicError   `json:"error,omitempty"`
}

func NewEvent

func NewEvent(exec Execution, sequence uint64, kind string, payload map[string]any) (Event, error)

func (Event) MarshalJSON

func (e Event) MarshalJSON() ([]byte, error)

type Execution

type Execution struct {
	ID                string     `json:"execution_id"`
	PluginInstanceID  string     `json:"plugin_instance_id"`
	Kind              string     `json:"kind"`
	Status            string     `json:"status"`
	Cursor            uint64     `json:"cursor"`
	FailureCode       string     `json:"failure_code,omitempty"`
	Cancelable        bool       `json:"cancelable"`
	CreatedAt         time.Time  `json:"created_at"`
	UpdatedAt         time.Time  `json:"updated_at"`
	CancelRequestedAt *time.Time `json:"cancel_requested_at,omitempty"`
	TerminalAt        *time.Time `json:"terminal_at,omitempty"`
	// contains filtered or unexported fields
}

func New

func New(value Execution) (Execution, error)

func (*Execution) Append

func (e *Execution) Append(event Event) error

func (Execution) EventsAfter

func (e Execution) EventsAfter(cursor uint64) []Event

func (*Execution) Finish

func (e *Execution) Finish(status, failureCode string, event Event, now time.Time) error

func (*Execution) RequestCancel

func (e *Execution) RequestCancel(now time.Time) error

func (Execution) Validate

func (e Execution) Validate() error

type PublicError

type PublicError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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