Documentation
¶
Index ¶
- Constants
- Variables
- func ValidRunID(id string) bool
- func ValidTaskID(id string) bool
- type ApprovalGate
- type Artifact
- type Capabilities
- type CreateRequest
- type CreateRunRequest
- type Event
- type GateState
- type Lease
- type OperationClass
- type Replay
- type Run
- type RunState
- type Store
- func (s *Store) Acknowledge(id, actor string) (Task, error)
- func (s *Store) AcknowledgeAuthorized(id, actor, capability string) (Task, error)
- func (s *Store) ApproveRun(id, gateID, actor string, gateGeneration, leaseGeneration uint64, ...) (Run, error)
- func (s *Store) BindTarget(id, target string) (Task, error)
- func (s *Store) Cancel(id, actor string) (Task, error)
- func (s *Store) CancelAuthorized(id, actor, capability string) (Task, error)
- func (s *Store) CancelRun(id, coordinator string, generation uint64) (Run, error)
- func (s *Store) Create(req CreateRequest) (Task, bool, error)
- func (s *Store) CreateAuthorized(req CreateRequest) (Task, Capabilities, bool, error)
- func (s *Store) CreateRun(req CreateRunRequest) (Run, bool, error)
- func (s *Store) Expire(now time.Time) ([]Task, error)
- func (s *Store) FailQueued(id, reason string) (Task, error)
- func (s *Store) Get(id string) (Task, error)
- func (s *Store) GetRun(id string) (Run, error)
- func (s *Store) HealthError() error
- func (s *Store) List() []Task
- func (s *Store) ListRuns() []Run
- func (s *Store) PublishRunState(sessionID, state, reason string) error
- func (s *Store) PublishRunStateRemoved(sessionID string) error
- func (s *Store) ReconcileRuns(now time.Time) ([]Run, error)
- func (s *Store) ReplayEvents(since uint64, limit int) (Replay, error)
- func (s *Store) ResumeRun(id, coordinator string, generation uint64, leaseDuration time.Duration) (Run, error)
- func (s *Store) SetResult(id, actor, summary string, artifacts []Artifact, failed bool) (Task, error)
- func (s *Store) SetResultAuthorized(id, actor, capability, summary string, artifacts []Artifact, failed bool) (Task, error)
- func (s *Store) Transition(id, actor string, to TaskState, reason string) (Task, error)
- func (s *Store) TransitionAuthorized(id, actor, capability string, to TaskState, reason string) (Task, error)
- func (s *Store) TransitionSystem(id string, to TaskState, reason string) (Task, error)
- func (s *Store) WaitEvents(ctx context.Context, since uint64, limit int, wait time.Duration) (Replay, error)
- type Task
- type TaskState
Constants ¶
View Source
const ( MaxEvents = 512 MaxEventLogBytes = 256 * 1024 MaxReplayLimit = 200 )
View Source
const ( MaxRuns = 256 MaxRunTasks = 128 MaxRunGates = 16 MinLeaseDuration = 5 * time.Second MaxLeaseDuration = 30 * time.Minute )
View Source
const ( MaxResultSummary = 8192 MaxReason = 1024 )
View Source
const MaxTasks = 1000
Variables ¶
View Source
var ( ErrNotFound = errors.New("task not found") ErrConflict = errors.New("task state conflict") ErrForbidden = errors.New("task mutation forbidden") ErrInvalid = errors.New("invalid task") )
View Source
var (
ErrLeaseConflict = errors.New("run lease conflict")
)
View Source
var ErrReplayGap = errors.New("orchestration event gap")
Functions ¶
func ValidRunID ¶
func ValidTaskID ¶
Types ¶
type ApprovalGate ¶
type ApprovalGate struct {
ID string `json:"id"`
Operation OperationClass `json:"operation"`
State GateState `json:"state"`
Generation uint64 `json:"generation"`
ExpiresAt time.Time `json:"expires_at"`
ApprovedBy string `json:"approved_by,omitempty"`
ApprovedAt *time.Time `json:"approved_at,omitempty"`
}
type Capabilities ¶
type Capabilities struct{ Sender, Target string }
type CreateRequest ¶
type CreateRunRequest ¶
type OperationClass ¶
type OperationClass string
const ( OperationMerge OperationClass = "merge" OperationPush OperationClass = "push" OperationDelete OperationClass = "delete" )
type Run ¶
type Run struct {
ID string `json:"id"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
GoalRef string `json:"goal_ref"`
TaskIDs []string `json:"task_ids,omitempty"`
Dependencies map[string][]string `json:"dependencies,omitempty"`
CurrentTaskID string `json:"current_task_id,omitempty"`
LastAckedTaskID string `json:"last_acked_task_id,omitempty"`
State RunState `json:"state"`
Reason string `json:"reason,omitempty"`
Owner string `json:"owner"`
Lease Lease `json:"lease"`
RetryCount int `json:"retry_count"`
Gates []ApprovalGate `json:"gates,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AcknowledgeAuthorized ¶
func (*Store) ApproveRun ¶
func (*Store) CancelAuthorized ¶
func (*Store) CreateAuthorized ¶
func (s *Store) CreateAuthorized(req CreateRequest) (Task, Capabilities, bool, error)
func (*Store) HealthError ¶
func (*Store) PublishRunState ¶
func (*Store) PublishRunStateRemoved ¶
func (*Store) SetResultAuthorized ¶
func (*Store) Transition ¶
func (*Store) TransitionAuthorized ¶
func (*Store) TransitionSystem ¶
TransitionSystem records delivery-system outcomes. It is intentionally separate from actor-authorized transitions so REST callers cannot acquire server authority by omitting an actor.
type Task ¶
type Task struct {
ID string `json:"id"`
ParentID string `json:"parent_id,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
RunID string `json:"run_id,omitempty"`
FromSessionID string `json:"from_session_id"`
TargetSessionID string `json:"target_session_id,omitempty"`
TargetProfile string `json:"target_profile,omitempty"`
State TaskState `json:"state"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeadlineAt *time.Time `json:"deadline_at,omitempty"`
ResultSummary string `json:"result_summary,omitempty"`
Artifacts []Artifact `json:"artifacts,omitempty"`
Reason string `json:"reason,omitempty"`
AcknowledgedAt *time.Time `json:"acknowledged_at,omitempty"`
SenderCapabilityHash string `json:"sender_capability_hash,omitempty"`
TargetCapabilityHash string `json:"target_capability_hash,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.