Documentation ¶
Index ¶
- Constants
- type Job
- type Jobs
- func (j *Jobs) Clear() error
- func (j *Jobs) Commit() error
- func (j *Jobs) ExecuteAll(ctx *snow.ConsensusContext, halter common.Haltable, restarted bool, ...) (int, error)
- func (j *Jobs) Has(jobID ids.ID) (bool, error)
- func (j *Jobs) PendingJobs() uint64
- func (j *Jobs) Push(job Job) (bool, error)
- func (j *Jobs) SetParser(parser Parser) error
- type JobsWithMissing
- func (jm *JobsWithMissing) AddMissingID(jobIDs ...ids.ID)
- func (jm *JobsWithMissing) Clear() error
- func (jm *JobsWithMissing) Commit() error
- func (jm *JobsWithMissing) Has(jobID ids.ID) (bool, error)
- func (jm *JobsWithMissing) MissingIDs() []ids.ID
- func (jm *JobsWithMissing) NumMissingIDs() int
- func (jm *JobsWithMissing) Push(job Job) (bool, error)
- func (jm *JobsWithMissing) RemoveMissingID(jobIDs ...ids.ID)
- func (jm *JobsWithMissing) SetParser(parser Parser) error
- type Parser
- type TestJob
- type TestParser
Constants ¶
View Source
const ( // StatusUpdateFrequency is how many containers should be processed between // logs StatusUpdateFrequency = 2500 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job interface { ID() ids.ID MissingDependencies() (ids.Set, error) // Returns true if this job has at least 1 missing dependency HasMissingDependencies() (bool, error) Execute() error Bytes() []byte }
Job defines the interface required to be placed on the job queue.
type Jobs ¶
type Jobs struct {
// contains filtered or unexported fields
}
Jobs tracks a series of jobs that form a DAG of dependencies.
func New ¶
func New( db database.Database, metricsNamespace string, metricsRegisterer prometheus.Registerer, ) (*Jobs, error)
New attempts to create a new job queue from the provided database.
func (*Jobs) ExecuteAll ¶ added in v1.6.11
func (j *Jobs) ExecuteAll(ctx *snow.ConsensusContext, halter common.Haltable, restarted bool, events ...snow.EventDispatcher) (int, error)
func (*Jobs) PendingJobs ¶ added in v1.6.11
Returns how many pending jobs are waiting in the queue.
type JobsWithMissing ¶ added in v1.6.11
type JobsWithMissing struct { *Jobs // contains filtered or unexported fields }
func NewWithMissing ¶ added in v1.6.11
func NewWithMissing( db database.Database, metricsNamespace string, metricsRegisterer prometheus.Registerer, ) (*JobsWithMissing, error)
func (*JobsWithMissing) AddMissingID ¶ added in v1.6.11
func (jm *JobsWithMissing) AddMissingID(jobIDs ...ids.ID)
AddMissingID adds [jobID] to missingIDs
func (*JobsWithMissing) Clear ¶ added in v1.6.11
func (jm *JobsWithMissing) Clear() error
func (*JobsWithMissing) Commit ¶ added in v1.6.11
func (jm *JobsWithMissing) Commit() error
Commit the versionDB to the underlying database.
func (*JobsWithMissing) Has ¶ added in v1.6.11
func (jm *JobsWithMissing) Has(jobID ids.ID) (bool, error)
func (*JobsWithMissing) MissingIDs ¶ added in v1.6.11
func (jm *JobsWithMissing) MissingIDs() []ids.ID
func (*JobsWithMissing) NumMissingIDs ¶ added in v1.6.11
func (jm *JobsWithMissing) NumMissingIDs() int
func (*JobsWithMissing) Push ¶ added in v1.6.11
func (jm *JobsWithMissing) Push(job Job) (bool, error)
Push adds a new job to the queue. Returns true if [job] was added to the queue and false if [job] was already in the queue.
func (*JobsWithMissing) RemoveMissingID ¶ added in v1.6.11
func (jm *JobsWithMissing) RemoveMissingID(jobIDs ...ids.ID)
RemoveMissingID removes [jobID] from missingIDs
func (*JobsWithMissing) SetParser ¶ added in v1.6.11
func (jm *JobsWithMissing) SetParser(parser Parser) error
SetParser tells this job queue how to parse jobs from the database.
type TestJob ¶
type TestJob struct { T *testing.T CantID, CantMissingDependencies, CantExecute, CantBytes, CantHasMissingDependencies bool IDF func() ids.ID MissingDependenciesF func() (ids.Set, error) ExecuteF func() error BytesF func() []byte HasMissingDependenciesF func() (bool, error) }
TestJob is a test Job
func (*TestJob) HasMissingDependencies ¶ added in v1.6.11
Click to show internal directories.
Click to hide internal directories.