inflight

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package inflight manages persisted tracking of active tasks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID             string    `json:"id"`
	StartedAt      time.Time `json:"started_at,omitempty"`
	Worktree       string    `json:"worktree_path,omitempty"`
	WorkerStateDir string    `json:"worker_state_dir,omitempty"`
	Stage          string    `json:"stage,omitempty"`
	Role           string    `json:"role,omitempty"`
}

Entry captures per-task in-flight metadata.

type Set

type Set map[string]Entry

Set tracks in-flight task IDs in memory along with metadata.

func (Set) Add

func (set Set) Add(id string) error

Add inserts a task ID into the set.

func (Set) AddWithStart

func (set Set) AddWithStart(id string, startedAt time.Time) error

AddWithStart tracks a task ID with the provided start time.

func (Set) AddWithStartAndPath

func (set Set) AddWithStartAndPath(id string, startedAt time.Time, worktreePath string, workerStateDir string, stage string, role string) error

AddWithStartAndPath tracks a task ID with the provided start time, worktree path, worker state dir, stage, and role.

func (Set) Contains

func (set Set) Contains(id string) bool

Contains reports whether the set includes the provided task ID.

func (Set) Entry

func (set Set) Entry(id string) (Entry, bool)

Entry returns the stored entry for a task when present.

func (Set) IDs

func (set Set) IDs() []string

IDs returns the task IDs in sorted order.

func (Set) Remove

func (set Set) Remove(id string) error

Remove deletes a task ID from the set when present.

func (Set) StartedAt

func (set Set) StartedAt(id string) (time.Time, bool)

StartedAt returns the recorded start time for a task when present.

func (Set) WorktreePath

func (set Set) WorktreePath(id string) (string, bool)

WorktreePath returns the stored worktree path for a task when present.

type Store

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

Store provides access to persisted in-flight task tracking.

func NewStore

func NewStore(repoRoot string) (Store, error)

NewStore builds a Store rooted at the provided repository root.

func (Store) Add

func (store Store) Add(ids ...string) (Set, error)

Add records task IDs as in-flight and persists the updated set.

func (Store) Load

func (store Store) Load() (Set, error)

Load reads the in-flight task set from disk.

func (Store) Remove

func (store Store) Remove(ids ...string) (Set, error)

Remove clears task IDs from in-flight tracking and persists the updated set.

func (Store) Save

func (store Store) Save(set Set) error

Save writes the in-flight task set to disk deterministically.

Jump to

Keyboard shortcuts

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