runstate

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package runstate encodes storage states that fence unsupported workers.

Index

Constants

View Source
const PausedPrepared = "paused_prepared"

PausedPrepared is deliberately unknown to readers predating preparation. Their atomic resume and expiry claims match only the literal paused state.

Variables

This section is empty.

Functions

func Decode

func Decode(stored string) run.State

Decode restores the public state understood by preparation-aware workers.

func DecodeProgress added in v1.10.0

func DecodeProgress(stored string, p *suspension.Progress) error

DecodeProgress reverses EncodeProgress into p.

func DecodeReady added in v1.10.0

func DecodeReady(stored *string) (*run.Readiness, error)

DecodeReady reverses EncodeReady.

func Encode

func Encode(r *run.Run) string

Encode protects prepared pauses while retaining the public lifecycle.

func EncodeProgress added in v1.10.0

func EncodeProgress(p *suspension.Progress) (string, error)

EncodeProgress returns the SQL column value for a progress snapshot.

func EncodeReady added in v1.10.0

func EncodeReady(ready *run.Readiness) (*string, error)

EncodeReady returns the SQL column value for a run's readiness. Nil is stored as NULL.

func LeaseColumns added in v1.10.0

func LeaseColumns(lease *run.Lease) (string, *time.Time)

LeaseColumns splits a run's lease into its owner and expiry columns. A zero lease, or none, is stored as no owner and a NULL expiry, which no lapsed listing ever matches.

func LeaseFromColumns added in v1.10.0

func LeaseFromColumns(owner string, expiresAt *time.Time) *run.Lease

LeaseFromColumns reverses LeaseColumns.

func NextRevision

func NextRevision(current int64) (int64, error)

NextRevision rejects invalid or exhausted versions without wrapping around.

func UTCTime added in v1.10.0

func UTCTime(t *time.Time) *time.Time

UTCTime returns a copy of t in UTC, or nil.

func UpdateConflict

func UpdateConflict(ctx context.Context, reader interface {
	GetRun(context.Context, id.AgentRunID) (*run.Run, error)
}, scope cortex.Scope, runID id.AgentRunID) error

UpdateConflict classifies a failed conditional write without exposing a run outside the exact caller scope. The read is diagnostic, never write authority.

Types

This section is empty.

Jump to

Keyboard shortcuts

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