Documentation ¶
Overview ¶
Package resource provides model representations that users of job-manager typically interact with. job-manager as well as backends should use these types, as opposed to protobufs or backend representations.
Index ¶
- Variables
- func ParseCLIArgs(args []string) ([]interface{}, error)
- func StatusIsDone(status *Status) bool
- func StatusStrings(statuses ...*Status) []string
- type Ack
- type Acks
- type Duration
- type Error
- func NewBlockedError(resource, resourceID, reason string) *Error
- func NewConflictError(resource, resourceID, reason string) *Error
- func NewInternalServerError(err error) *Error
- func NewNotFoundError(resource, resourceID, reason string) *Error
- func NewUnprocessableEntityError(resource, resourceID, reason string, ids []string) *Error
- func NewValidationError(resource, resourceID, reason string, verrs []*ValidationError) *Error
- type GetByIDOpts
- type Job
- type JobCheckin
- type JobData
- type JobListParams
- type JobResult
- type Jobs
- type NullRawMessage
- type NullTime
- type Pagination
- type Queue
- type QueueListParams
- type Queues
- type Stats
- type Status
- type ValidationError
- type Version
- func (v *Version) Equals(other *Version) bool
- func (v *Version) Inc()
- func (v Version) MarshalJSON() ([]byte, error)
- func (v *Version) Raw() int32
- func (v *Version) Scan(value interface{}) error
- func (v *Version) Strict() string
- func (v *Version) String() string
- func (v *Version) UnmarshalJSON(b []byte) error
- func (v *Version) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrGenericNotFound = &Error{ Status: http.StatusNotFound, Message: "not found", Kind: "not_found", }
View Source
var ErrMethodNotAllowed = &Error{ Status: http.StatusMethodNotAllowed, Message: "method not allowed", Kind: "method_not_allowed", }
Functions ¶
func ParseCLIArgs ¶ added in v0.3.0
func StatusIsDone ¶
func StatusStrings ¶
Types ¶
type Ack ¶
type Error ¶
type Error struct { Status int `json:"status,omitempty"` Message string `json:"message"` Kind string `json:"kind"` Resource string `json:"resource,omitempty"` ResourceID string `json:"resource_id,omitempty"` Reason string `json:"reason,omitempty"` Orig error `json:"orig,omitempty"` Invalid []*ValidationError `json:"invalid,omitempty"` IDs []string `json:"ids,omitempty"` }
func NewBlockedError ¶ added in v0.4.0
func NewConflictError ¶
func NewInternalServerError ¶
func NewNotFoundError ¶
func NewValidationError ¶
func NewValidationError(resource, resourceID, reason string, verrs []*ValidationError) *Error
type GetByIDOpts ¶
type GetByIDOpts struct {
Includes []string `json:"include,omitempty"`
}
type Job ¶
type Job struct { ID string `json:"id"` // QueueID is the id of the queue that manages this job. QueueID string `json:"-" db:"queue_id"` Version *Version `json:"version" db:"v"` Name string `json:"name"` QueueVersion *Version `json:"queue_version" db:"queue_v"` ArgsRaw []byte `json:"args" db:"args"` Data *JobData `json:"data,omitempty" db:"-"` DataRaw []byte `json:"-" db:"data"` Status *Status `json:"status"` Attempt int `json:"attempt,omitempty"` Checkins []*JobCheckin `json:"checkins,omitempty"` Results []*JobResult `json:"results,omitempty"` EnqueuedAt time.Time `json:"enqueued_at,omitempty" db:"enqueued_at"` StartedAt NullTime `json:"-" db:"started_at"` CompletedAt NullTime `json:"-" db:"completed_at"` BackoffInitial Duration `json:"-" db:"backoff_initial_duration"` BackoffMax Duration `json:"-" db:"backoff_max_duration"` BackoffFactor float32 `json:"-" db:"backoff_factor"` // Duration lives on queues, but consumers need it for correct timeouts. Duration Duration `json:"duration,omitempty" db:"duration"` }
func (*Job) IsAttempted ¶
func (*Job) LastClaimWindow ¶
func (*Job) LastResult ¶
type JobCheckin ¶
type JobListParams ¶
type JobListParams struct { Queues []string `json:"names,omitempty"` Statuses []*Status `json:"statuses,omitempty"` Selectors *label.Selectors `json:"selectors,omitempty"` Claims label.Claims `json:"claims,omitempty"` EnqueuedSince time.Time `json:"enqueued_since,omitempty"` EnqueuedUntil time.Time `json:"enqueued_until,omitempty"` NoPaused bool `json:"no_paused,omitempty"` NoBlocked bool `json:"no_blocked,omitempty"` // NoUnclaimed will exclude jobs that have outstanding claims. NoUnclaimed bool `json:"no_unclaimed,omitempty"` Page *Pagination `json:"page,omitempty"` Includes []string `json:"include,omitempty"` }
type JobResult ¶
type JobResult struct { ID string `json:"-"` JobID string `json:"-" db:"job_id"` Attempt int `json:"attempt"` Status *Status `json:"status"` Data []byte `json:"data,omitempty"` Error string `json:"error,omitempty"` StartedAt time.Time `json:"started_at" db:"started_at"` CompletedAt time.Time `json:"completed_at" db:"completed_at"` }
type NullRawMessage ¶
type NullRawMessage struct { json.RawMessage Valid bool }
func (*NullRawMessage) Scan ¶
func (n *NullRawMessage) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullTime ¶ added in v0.3.0
func (NullTime) MarshalJSON ¶ added in v0.3.0
func (*NullTime) UnmarshalJSON ¶ added in v0.3.0
type Pagination ¶
type Queue ¶
type Queue struct { ID string `json:"-"` Name string `json:"name"` Version *Version `json:"version" db:"v"` Retries int `json:"retries,omitempty"` Duration Duration `json:"duration,omitempty"` CheckinDuration Duration `json:"checkin_duration,omitempty" db:"checkin_duration"` ClaimDuration Duration `json:"claim_duration,omitempty" db:"claim_duration"` Unique bool `json:"unique,omitempty" db:"unique_args"` Labels label.Labels `json:"labels,omitempty"` SchemaRaw []byte `json:"schema_raw,omitempty" db:"job_schema"` BackoffInitial Duration `json:"backoff_initial" db:"backoff_initial_duration"` BackoffMax Duration `json:"backoff_max" db:"backoff_max_duration"` BackoffFactor float32 `json:"backoff_factor" db:"backoff_factor"` Paused bool `json:"paused"` Unpaused bool `json:"unpaused"` Blocked bool `json:"blocked"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"-" db:"updated_at"` DeletedAt NullTime `json:"deleted_at,omitempty" db:"deleted_at"` }
func (*Queue) EqualAttrs ¶
type QueueListParams ¶
type QueueListParams struct { Names []string `json:"names,omitempty"` Selectors *label.Selectors `json:"selectors,omitempty"` Page *Pagination `json:"page,omitempty"` Includes []string `json:"include,omitempty"` }
type Status ¶
type Status int
func StatusFromString ¶
func StatusesFromStrings ¶
func (Status) MarshalJSON ¶ added in v0.3.0
func (*Status) UnmarshalJSON ¶ added in v0.3.0
type ValidationError ¶
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
func NewVersion ¶
func NewVersionFromString ¶
func (Version) MarshalJSON ¶
func (*Version) UnmarshalJSON ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.