runstate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound          = errors.New("runstate: not found")
	ErrStaleSnapshot     = errors.New("runstate: snapshot version is stale")
	ErrInvalidStatus     = errors.New("runstate: invalid status")
	ErrInvalidTransition = errors.New("runstate: invalid status transition")
	ErrTokenSuperseded   = errors.New("humangate: token superseded by newer version")
)
View Source
var ErrInvalidToken = errors.New("runstate: invalid token")

Functions

This section is empty.

Types

type BlobRef

type BlobRef struct {
	ID     string `json:"id"`
	Size   int64  `json:"size"`
	Sha256 string `json:"sha256"`
}

func NewBlobRef

func NewBlobRef(id string, data []byte) BlobRef

type BlobStore

type BlobStore interface {
	Put(ctx context.Context, data []byte) (BlobRef, error)
	Get(ctx context.Context, ref BlobRef) ([]byte, error)
}

type Repository

type Repository interface {
	Save(ctx context.Context, snapshot *RunSnapshot, expectedVersion int64) error
	Load(ctx context.Context, runID string) (RunSnapshot, error)
	Delete(ctx context.Context, runID string) error
}

type RunSnapshot

type RunSnapshot struct {
	RunID         string                     `json:"run_id"`
	Version       int64                      `json:"version"`
	ScenarioName  string                     `json:"scenario_name"`
	CurrentNodeID string                     `json:"current_node_id,omitempty"`
	Status        RunStatus                  `json:"status"`
	Variables     map[string]json.RawMessage `json:"variables,omitempty"`
	StepOutputs   map[string]StepOutputRef   `json:"step_outputs,omitempty"`
	PendingGate   *core.CheckpointState      `json:"pending_gate,omitempty"`
}

func (RunSnapshot) Validate

func (s RunSnapshot) Validate() error

type RunStatus

type RunStatus string
const (
	RunStatusRunning   RunStatus = "running"
	RunStatusPaused    RunStatus = "paused"
	RunStatusFailed    RunStatus = "failed"
	RunStatusCompleted RunStatus = "completed"
	RunStatusCancelled RunStatus = "cancelled"
)

func (RunStatus) CanTransitionTo

func (s RunStatus) CanTransitionTo(next RunStatus) bool

func (RunStatus) Valid

func (s RunStatus) Valid() bool

type StepOutputRef

type StepOutputRef struct {
	Inline json.RawMessage `json:"inline,omitempty"`
	Blob   *BlobRef        `json:"blob,omitempty"`
}

type TokenPayload

type TokenPayload struct {
	RunID     string    `json:"run_id"`
	Version   int64     `json:"version"`
	ExpiresAt time.Time `json:"expires_at,omitempty"`
}

type TokenSigner

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

func NewTokenSigner

func NewTokenSigner(secret []byte) (*TokenSigner, error)

func (*TokenSigner) Sign

func (s *TokenSigner) Sign(payload TokenPayload) (string, error)

func (*TokenSigner) Verify

func (s *TokenSigner) Verify(token string) (TokenPayload, error)

Jump to

Keyboard shortcuts

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