Documentation
¶
Overview ¶
Package queue provides a persistent work queue for incremental certification. Items are persisted to disk after each state change so progress survives crashes, rate limits, and multi-run processing.
Index ¶
- Constants
- type Item
- type ItemStatus
- type Queue
- func (q *Queue) BatchNext(n int) []Item
- func (q *Queue) Complete(unitID, model string)
- func (q *Queue) Enqueue(unitID, filePath string)
- func (q *Queue) Fail(unitID, errMsg string)
- func (q *Queue) Len() int
- func (q *Queue) Next() (Item, bool)
- func (q *Queue) Reset()
- func (q *Queue) Save(path string) error
- func (q *Queue) Skip(unitID, reason string)
- func (q *Queue) Stats() Stats
- type Stats
Constants ¶
View Source
const DefaultMaxRetries = 3
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct {
UnitID string `json:"unit_id"`
FilePath string `json:"file_path"`
Status ItemStatus `json:"status"`
Model string `json:"model,omitempty"` // model that processed this item
Error string `json:"error,omitempty"` // last error message
Reason string `json:"reason,omitempty"` // skip/complete reason
Retries int `json:"retries"` // number of failed attempts
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Item is a single unit of work in the queue.
type ItemStatus ¶
type ItemStatus string
ItemStatus represents the processing state of a queue item.
const ( StatusPending ItemStatus = "pending" StatusInProgress ItemStatus = "in_progress" StatusCompleted ItemStatus = "completed" StatusSkipped ItemStatus = "skipped" StatusFailed ItemStatus = "failed" )
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is a persistent work queue for certification processing.
func (*Queue) Next ¶
Next returns the next pending or retryable item and marks it in_progress. Returns (item, true) if found, (zero, false) if queue is exhausted.
func (*Queue) Reset ¶
func (q *Queue) Reset()
Reset sets all items back to pending (for re-processing).
Click to show internal directories.
Click to hide internal directories.