Documentation ¶
Overview ¶
Package jobs supports jobs, which are collections of enqueued tasks.
Index ¶
- type DB
- func (d *DB) CreateJob(ctx context.Context, j *Job) (err error)
- func (d *DB) DeleteJob(ctx context.Context, id string) (err error)
- func (d *DB) GetJob(ctx context.Context, id string) (_ *Job, err error)
- func (d *DB) Increment(ctx context.Context, id, name string, n int) (err error)
- func (d *DB) ListJobs(ctx context.Context, f func(_ *Job, lastUpdate time.Time) error) (err error)
- func (d *DB) UpdateJob(ctx context.Context, id string, f func(*Job) error) (err error)
- type Job
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) CreateJob ¶
CreateJob creates a new job. It returns an error if a job with the same ID already exists.
func (*DB) DeleteJob ¶
DeleteJob deletes the job with the given ID. It does not return an error if the job doesn't exist.
func (*DB) GetJob ¶
GetJob retrieves the job with the given ID. It returns an error if the job does not exist.
func (*DB) ListJobs ¶
ListJobs calls f on each job in the DB, most recently started first. f is also passed the time that the job was last updated. If f returns a non-nil error, the iteration stops and returns that error.
type Job ¶
type Job struct { User string StartedAt time.Time URL string // The URL that initiated the job. Binary string // Name of binary. BinaryVersion string // Hex-encoded hash of binary. BinaryArgs string // The args to the binary. Canceled bool // The job was canceled. // Counts of tasks. NumEnqueued int // Written by enqueue endpoint. NumStarted int // Incremented at the start of a scan. NumSkipped int // Previously run, stored in BigQuery. NumFailed int // The HTTP request failed (status != 200) NumErrored int // The HTTP request succeeded, but the scan resulted in an error. NumSucceeded int }
A Job is a set of related scan tasks enqueued at the same time.
func (*Job) NumFinished ¶
Click to show internal directories.
Click to hide internal directories.