Documentation
¶
Index ¶
- Constants
- Variables
- func NewEnvelopeID(now time.Time) string
- func Permanent(err error) error
- func RegistryObservation(report Report) registry.Observation
- func RegistryReport(report Report) registry.Observation
- func RootForStore(storePath string) string
- type DrainOptions
- type DrainResult
- type EnqueueOptions
- type EnqueueResult
- type Envelope
- type PermanentError
- type Processor
- type Queue
- func (q Queue) Drain(ctx context.Context, options DrainOptions) (DrainResult, error)
- func (q Queue) Enqueue(ctx context.Context, envelope Envelope, options EnqueueOptions) (EnqueueResult, error)
- func (q Queue) LookupTmuxContext(reference registry.TmuxContext, now time.Time, ttl time.Duration) (registry.TmuxContext, bool)
- func (q Queue) Root() string
- func (q Queue) Status(ctx context.Context) (StatusResult, error)
- func (q Queue) StoreTmuxContext(ctx context.Context, tmux registry.TmuxContext, now time.Time) error
- type Report
- type RuntimeContext
- type StatusResult
Constants ¶
View Source
const ( EnvelopeVersion = 2 KindReport = "report" )
Variables ¶
View Source
var ErrLocked = errors.New("queue is locked")
Functions ¶
func NewEnvelopeID ¶
func RegistryObservation ¶
func RegistryObservation(report Report) registry.Observation
func RegistryReport ¶
func RegistryReport(report Report) registry.Observation
func RootForStore ¶
Types ¶
type DrainOptions ¶
type DrainResult ¶
type EnqueueOptions ¶
type EnqueueResult ¶
type Envelope ¶
type Envelope struct {
Version int `json:"version"`
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
StorePath string `json:"store_path"`
Kind string `json:"kind"`
Report Report `json:"report"`
RawPayloadSet bool `json:"raw_payload_set,omitempty"`
NoTmux bool `json:"no_tmux,omitempty"`
Runtime RuntimeContext `json:"runtime"`
Attempt int `json:"attempt,omitempty"`
NextAttemptAt time.Time `json:"next_attempt_at,omitzero"`
ProcessingStartedAt time.Time `json:"processing_started_at,omitzero"`
WorkerPID int `json:"worker_pid,omitempty"`
LastError string `json:"last_error,omitempty"`
CachedTmux registry.TmuxContext `json:"cached_tmux,omitzero"`
}
type PermanentError ¶
type PermanentError struct {
Err error
}
func (PermanentError) Error ¶
func (e PermanentError) Error() string
func (PermanentError) Unwrap ¶
func (e PermanentError) Unwrap() error
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
func (Queue) Drain ¶
func (q Queue) Drain(ctx context.Context, options DrainOptions) (DrainResult, error)
func (Queue) Enqueue ¶
func (q Queue) Enqueue(ctx context.Context, envelope Envelope, options EnqueueOptions) (EnqueueResult, error)
func (Queue) LookupTmuxContext ¶
func (q Queue) LookupTmuxContext(reference registry.TmuxContext, now time.Time, ttl time.Duration) (registry.TmuxContext, bool)
func (Queue) StoreTmuxContext ¶
type Report ¶
type Report = registry.Observation
Report is the v2 observation payload carried by a queue envelope.
It aliases the registry contract so queue serialization cannot drift from registry observation semantics.
func ReportFromRegistry ¶
func ReportFromRegistry(observation registry.Observation) Report
type RuntimeContext ¶
type StatusResult ¶
type StatusResult struct {
Root string `json:"root"`
Pending int `json:"pending"`
Ready int `json:"ready"`
Deferred int `json:"deferred"`
Processing int `json:"processing"`
StaleLeases int `json:"stale_leases"`
Retries int `json:"retries"`
NextRetryAt time.Time `json:"next_retry_at,omitzero"`
Dead int `json:"dead"`
Invalid int `json:"invalid"`
OldestPendingAt time.Time `json:"oldest_pending_at,omitzero"`
OldestProcessingAt time.Time `json:"oldest_processing_at,omitzero"`
OldestBacklogAt time.Time `json:"oldest_backlog_at,omitzero"`
OldestDeadAt time.Time `json:"oldest_dead_at,omitzero"`
}
Click to show internal directories.
Click to hide internal directories.