67 lines
2.2 KiB
Go
67 lines
2.2 KiB
Go
package governance
|
|
|
|
import "time"
|
|
|
|
// JobFailure is one terminal-attempt dead-letter projection (P6). It never
|
|
// replaces the original jobs audit row; it points at it.
|
|
type JobFailure struct {
|
|
ID string `json:"id"`
|
|
JobID string `json:"job_id"`
|
|
JobType string `json:"job_type"`
|
|
PublicationID string `json:"publication_id,omitempty"`
|
|
SourceItemID string `json:"source_item_id,omitempty"`
|
|
ErrorCode string `json:"error_code"`
|
|
Attempt int `json:"attempt"`
|
|
MaxAttempts int `json:"max_attempts_at_failure"`
|
|
ChangeSetID string `json:"change_set_id,omitempty"`
|
|
Action string `json:"action,omitempty"`
|
|
TargetKBID string `json:"target_kb_id,omitempty"`
|
|
State string `json:"state"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
DocName string `json:"doc_name,omitempty"`
|
|
LastError string `json:"last_error,omitempty"`
|
|
}
|
|
|
|
type JobFailureFilter struct {
|
|
State string // open | requeued | abandoned | "" (defaults to open)
|
|
Limit int
|
|
Offset int
|
|
}
|
|
|
|
type JobFailurePage struct {
|
|
Items []JobFailure `json:"items"`
|
|
Total int `json:"total"`
|
|
Limit int `json:"limit"`
|
|
Offset int `json:"offset"`
|
|
}
|
|
|
|
const (
|
|
RetryStarted = "started"
|
|
RetryAlreadyRunning = "already_running"
|
|
RetryNotRetryable = "not_retryable"
|
|
)
|
|
|
|
// RetryPublicationsBatchRequest is the server-side batch retry (P6): one
|
|
// atomic operation covering 1..100 publications with per-item outcomes.
|
|
type RetryPublicationsBatchRequest struct {
|
|
PublicationIDs []string `json:"publication_ids"`
|
|
OperatorRef string `json:"operator_ref"`
|
|
Reason string `json:"reason"`
|
|
Now time.Time `json:"-"`
|
|
}
|
|
|
|
type RetryOutcome struct {
|
|
PublicationID string `json:"publication_id"`
|
|
Result string `json:"result"`
|
|
Detail string `json:"detail,omitempty"`
|
|
}
|
|
|
|
type RetryPublicationsBatchResult struct {
|
|
BatchKey string `json:"batch_key"`
|
|
Total int `json:"total"`
|
|
Started int `json:"started"`
|
|
AlreadyRunning int `json:"already_running"`
|
|
NotRetryable int `json:"not_retryable"`
|
|
Outcomes []RetryOutcome `json:"outcomes"`
|
|
}
|