Documentation
¶
Overview ¶
Package workstore provides memory, SQLite, and PostgreSQL backends for durable terminal-work intent, claims, retry, and quarantine (requirements 8.1–8.9).
Migrations use direct/admin connections; runtime pools verify schema only (design D12).
Index ¶
- Constants
- Variables
- func HasSelectiveBound(q Query) bool
- func Migrate(ctx context.Context, db *bun.DB) error
- func ValidateQuery(q Query) error
- func VerifySchema(ctx context.Context, db *bun.DB) error
- type ClaimDueCommand
- type CompleteCommand
- type DurableConfig
- type DurableStore
- func (s *DurableStore) AppendIntent(ctx context.Context, rec terminalwork.WorkRecord) error
- func (s *DurableStore) AppendIntentOutcome(ctx context.Context, rec terminalwork.WorkRecord) (terminalwork.AppendIntentOutcome, error)
- func (s *DurableStore) CheckReadiness(ctx context.Context) error
- func (s *DurableStore) ClaimDue(ctx context.Context, cmd ClaimDueCommand) ([]terminalwork.WorkRecord, error)
- func (s *DurableStore) Close() error
- func (s *DurableStore) Complete(ctx context.Context, cmd CompleteCommand) error
- func (s *DurableStore) GetBySourceKey(ctx context.Context, key terminalwork.SourceKey) (terminalwork.WorkRecord, error)
- func (s *DurableStore) GetByWorkID(ctx context.Context, workID string) (terminalwork.WorkRecord, error)
- func (s *DurableStore) List(ctx context.Context, q Query) (Page, error)
- func (s *DurableStore) LookupIntent(ctx context.Context, workID string) (terminalwork.WorkRecord, bool, error)
- func (s *DurableStore) PromotePending(ctx context.Context, cmd PromotePendingCommand) error
- func (s *DurableStore) Quarantine(ctx context.Context, cmd QuarantineCommand) error
- func (s *DurableStore) RenewClaim(ctx context.Context, cmd RenewClaimCommand) error
- func (s *DurableStore) ScheduleRetry(ctx context.Context, cmd ScheduleRetryCommand) error
- type MemoryConfig
- type MemoryState
- type MemoryStore
- func (s *MemoryStore) AppendIntent(ctx context.Context, rec terminalwork.WorkRecord) error
- func (s *MemoryStore) AppendIntentOutcome(ctx context.Context, rec terminalwork.WorkRecord) (terminalwork.AppendIntentOutcome, error)
- func (s *MemoryStore) CheckReadiness(ctx context.Context) error
- func (s *MemoryStore) ClaimDue(ctx context.Context, cmd ClaimDueCommand) ([]terminalwork.WorkRecord, error)
- func (s *MemoryStore) Close() error
- func (s *MemoryStore) Complete(ctx context.Context, cmd CompleteCommand) error
- func (s *MemoryStore) GetBySourceKey(ctx context.Context, key terminalwork.SourceKey) (terminalwork.WorkRecord, error)
- func (s *MemoryStore) GetByWorkID(ctx context.Context, workID string) (terminalwork.WorkRecord, error)
- func (s *MemoryStore) List(ctx context.Context, q Query) (Page, error)
- func (s *MemoryStore) LookupIntent(ctx context.Context, workID string) (terminalwork.WorkRecord, bool, error)
- func (s *MemoryStore) PromotePending(ctx context.Context, cmd PromotePendingCommand) error
- func (s *MemoryStore) Quarantine(ctx context.Context, cmd QuarantineCommand) error
- func (s *MemoryStore) RenewClaim(ctx context.Context, cmd RenewClaimCommand) error
- func (s *MemoryStore) ScheduleRetry(ctx context.Context, cmd ScheduleRetryCommand) error
- type Page
- type PromotePendingCommand
- type QuarantineCommand
- type Query
- type RenewClaimCommand
- type ScheduleRetryCommand
Constants ¶
const BaselineMigrationName = "20260718153000"
const MaxQueryLimit = terminalwork.MaxQueryLimit
const RuntimeGenerationIDMigrationName = "20260721093000"
const RuntimeInstanceIDMigrationName = "20260721104500"
Variables ¶
var ( ErrIdentityCollision = errors.New("terminalwork/workstore: identity collision") ErrNotFound = errors.New("terminalwork/workstore: not found") ErrConflict = sdk.ErrConflict ErrQueryTooBroad = terminalwork.ErrQueryTooBroad ErrQueryLimitExceeded = terminalwork.ErrQueryLimitExceeded ErrUniqueRaceMissingRow = errors.New("terminalwork/workstore: unique race missing winner row") )
var RequiredMigrationNames = []string{BaselineMigrationName, RuntimeGenerationIDMigrationName, RuntimeInstanceIDMigrationName}
Functions ¶
func HasSelectiveBound ¶
func ValidateQuery ¶
Types ¶
type ClaimDueCommand ¶
type ClaimDueCommand = terminalwork.ClaimDueCommand
Command types are owned by the core terminalwork package (hexagonal port).
type CompleteCommand ¶
type CompleteCommand = terminalwork.CompleteCommand
Command types are owned by the core terminalwork package (hexagonal port).
type DurableConfig ¶
type DurableStore ¶
type DurableStore struct {
// contains filtered or unexported fields
}
func NewDurableStore ¶
func NewDurableStore(ctx context.Context, db *bun.DB, cfg DurableConfig) (*DurableStore, error)
func OpenStore ¶
func OpenStore(ctx context.Context, db *bun.DB, cfg DurableConfig) (*DurableStore, error)
func (*DurableStore) AppendIntent ¶
func (s *DurableStore) AppendIntent(ctx context.Context, rec terminalwork.WorkRecord) error
func (*DurableStore) AppendIntentOutcome ¶
func (s *DurableStore) AppendIntentOutcome(ctx context.Context, rec terminalwork.WorkRecord) (terminalwork.AppendIntentOutcome, error)
AppendIntentOutcome implements the definitive insert-vs-replay seam.
func (*DurableStore) CheckReadiness ¶
func (s *DurableStore) CheckReadiness(ctx context.Context) error
func (*DurableStore) ClaimDue ¶
func (s *DurableStore) ClaimDue(ctx context.Context, cmd ClaimDueCommand) ([]terminalwork.WorkRecord, error)
func (*DurableStore) Close ¶
func (s *DurableStore) Close() error
func (*DurableStore) Complete ¶
func (s *DurableStore) Complete(ctx context.Context, cmd CompleteCommand) error
func (*DurableStore) GetBySourceKey ¶
func (s *DurableStore) GetBySourceKey(ctx context.Context, key terminalwork.SourceKey) (terminalwork.WorkRecord, error)
func (*DurableStore) GetByWorkID ¶
func (s *DurableStore) GetByWorkID(ctx context.Context, workID string) (terminalwork.WorkRecord, error)
func (*DurableStore) LookupIntent ¶
func (s *DurableStore) LookupIntent(ctx context.Context, workID string) (terminalwork.WorkRecord, bool, error)
LookupIntent implements terminalworkapp.IntentLookup.
func (*DurableStore) PromotePending ¶
func (s *DurableStore) PromotePending(ctx context.Context, cmd PromotePendingCommand) error
func (*DurableStore) Quarantine ¶
func (s *DurableStore) Quarantine(ctx context.Context, cmd QuarantineCommand) error
func (*DurableStore) RenewClaim ¶
func (s *DurableStore) RenewClaim(ctx context.Context, cmd RenewClaimCommand) error
func (*DurableStore) ScheduleRetry ¶
func (s *DurableStore) ScheduleRetry(ctx context.Context, cmd ScheduleRetryCommand) error
type MemoryConfig ¶
type MemoryState ¶
type MemoryState struct {
// contains filtered or unexported fields
}
func NewMemoryState ¶
func NewMemoryState() *MemoryState
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore(cfg MemoryConfig) (*MemoryStore, error)
func (*MemoryStore) AppendIntent ¶
func (s *MemoryStore) AppendIntent(ctx context.Context, rec terminalwork.WorkRecord) error
func (*MemoryStore) AppendIntentOutcome ¶
func (s *MemoryStore) AppendIntentOutcome(ctx context.Context, rec terminalwork.WorkRecord) (terminalwork.AppendIntentOutcome, error)
AppendIntentOutcome implements the definitive insert-vs-replay seam.
func (*MemoryStore) CheckReadiness ¶
func (s *MemoryStore) CheckReadiness(ctx context.Context) error
func (*MemoryStore) ClaimDue ¶
func (s *MemoryStore) ClaimDue(ctx context.Context, cmd ClaimDueCommand) ([]terminalwork.WorkRecord, error)
func (*MemoryStore) Close ¶
func (s *MemoryStore) Close() error
func (*MemoryStore) Complete ¶
func (s *MemoryStore) Complete(ctx context.Context, cmd CompleteCommand) error
func (*MemoryStore) GetBySourceKey ¶
func (s *MemoryStore) GetBySourceKey(ctx context.Context, key terminalwork.SourceKey) (terminalwork.WorkRecord, error)
func (*MemoryStore) GetByWorkID ¶
func (s *MemoryStore) GetByWorkID(ctx context.Context, workID string) (terminalwork.WorkRecord, error)
func (*MemoryStore) LookupIntent ¶
func (s *MemoryStore) LookupIntent(ctx context.Context, workID string) (terminalwork.WorkRecord, bool, error)
LookupIntent implements terminalworkapp.IntentLookup.
func (*MemoryStore) PromotePending ¶
func (s *MemoryStore) PromotePending(ctx context.Context, cmd PromotePendingCommand) error
func (*MemoryStore) Quarantine ¶
func (s *MemoryStore) Quarantine(ctx context.Context, cmd QuarantineCommand) error
func (*MemoryStore) RenewClaim ¶
func (s *MemoryStore) RenewClaim(ctx context.Context, cmd RenewClaimCommand) error
func (*MemoryStore) ScheduleRetry ¶
func (s *MemoryStore) ScheduleRetry(ctx context.Context, cmd ScheduleRetryCommand) error
type Page ¶
type Page = terminalwork.ListPage
Query/Page and bounds are owned by the core terminalwork package (hexagonal port).
type PromotePendingCommand ¶
type PromotePendingCommand = terminalwork.PromotePendingCommand
Command types are owned by the core terminalwork package (hexagonal port).
type QuarantineCommand ¶
type QuarantineCommand = terminalwork.QuarantineCommand
Command types are owned by the core terminalwork package (hexagonal port).
type Query ¶
type Query = terminalwork.ListQuery
Query/Page and bounds are owned by the core terminalwork package (hexagonal port).
type RenewClaimCommand ¶
type RenewClaimCommand = terminalwork.RenewClaimCommand
Command types are owned by the core terminalwork package (hexagonal port).
type ScheduleRetryCommand ¶
type ScheduleRetryCommand = terminalwork.ScheduleRetryCommand
Command types are owned by the core terminalwork package (hexagonal port).