Documentation
¶
Overview ¶
Package store owns the SQLite ledger and its migrations.
Index ¶
- Variables
- func Terminal(state string) bool
- type ImmediateTx
- type JobState
- type Run
- type Store
- func (s *Store) AdvanceCursor(ctx context.Context, st JobState) error
- func (s *Store) CheckIdentity() error
- func (s *Store) ClaimOwned(ctx context.Context, id string, at time.Time, ownerStart time.Time) error
- func (s *Store) ClaimRun(ctx context.Context, id string) error
- func (s *Store) ClearKept(ctx context.Context, id string) error
- func (s *Store) Close() error
- func (s *Store) CreateRun(ctx context.Context, r Run) error
- func (s *Store) DeleteTerminal(ctx context.Context, id string) (bool, error)
- func (s *Store) EnqueueFire(ctx context.Context, r Run) (Run, bool, error)
- func (s *Store) FinishClaimedRun(ctx context.Context, r Run) error
- func (s *Store) FinishRun(ctx context.Context, r Run) error
- func (s *Store) GetRun(ctx context.Context, id string) (Run, error)
- func (s *Store) JobStates(ctx context.Context) (map[string]JobState, error)
- func (s *Store) ListRuns(ctx context.Context, job, state string, limit int) ([]Run, error)
- func (s *Store) MemoryNote(ctx context.Context, job string) (string, error)
- func (s *Store) PreviousRun(ctx context.Context, r Run) (*Run, error)
- func (s *Store) PutJobState(ctx context.Context, st JobState) error
- func (s *Store) SchemaVersion(ctx context.Context) (int, error)
- func (s *Store) SetDaemonStopped(ctx context.Context, id string) error
- func (s *Store) SetMemoryNote(ctx context.Context, job, note string) error
- func (s *Store) StartOwnedRun(ctx context.Context, r Run) error
- func (s *Store) StartRun(ctx context.Context, id string, pid int, at time.Time, worktree string) error
- func (s *Store) SyncDefinition(ctx context.Context, st JobState) error
- func (s *Store) Unknown(ctx context.Context, r Run) error
- func (s *Store) WithImmediateTx(ctx context.Context, fn func(*ImmediateTx) error) error
Constants ¶
This section is empty.
Variables ¶
var ErrRunNotFound = errors.New("run not found")
Functions ¶
Types ¶
type ImmediateTx ¶
type ImmediateTx struct {
// contains filtered or unexported fields
}
ImmediateTx exposes queries on the connection holding the write reservation. The connection and any rows must not escape the callback.
type JobState ¶
type JobState struct {
Fired bool `json:"-"`
ScheduleKey string `json:"-"`
Name string `json:"name"`
Paused bool `json:"paused"`
Approved bool `json:"approved"`
NextFire *time.Time `json:"next_fire"`
LastRunID string `json:"last_run_id"`
UpdatedAt time.Time `json:"updated_at"`
AnchorAt time.Time `json:"anchor_at"`
Orphaned bool `json:"orphaned"`
}
type Run ¶
type Run struct {
ID string `json:"id"`
Job string `json:"job"`
Trigger string `json:"trigger"`
ScheduledFor time.Time `json:"scheduled_for"`
State string `json:"state"`
PID *int `json:"pid"`
OwnerStart *time.Time `json:"owner_start"`
OwnerPID *int `json:"owner_pid"`
ProcStart *time.Time `json:"proc_start"`
ExitCode *int `json:"exit_code"`
StartedAt *time.Time `json:"started_at"`
EndedAt *time.Time `json:"ended_at"`
Worktree string `json:"worktree"`
Kept bool `json:"kept"`
Error string `json:"error"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func OpenExisting ¶
OpenExisting inspects an existing ledger without creating or migrating it.
func (*Store) CheckIdentity ¶
CheckIdentity rejects an unlinked or replaced ledger before another scheduling pass.
func (*Store) ClaimOwned ¶
func (*Store) DeleteTerminal ¶
func (*Store) EnqueueFire ¶
EnqueueFire reports actual insertion and retries primary-key collisions only.
func (*Store) MemoryNote ¶
func (*Store) PreviousRun ¶
PreviousRun finds terminal history independently of enqueue order.
func (*Store) SetDaemonStopped ¶
func (*Store) SetMemoryNote ¶
func (*Store) SyncDefinition ¶
SyncDefinition preserves a cursor advanced concurrently by the scheduler.
func (*Store) WithImmediateTx ¶
WithImmediateTx reserves the writer before invoking fn, even before its first write.