Documentation ¶
Index ¶
- type Job
- type Jobs
- func (j *Jobs) Clear() error
- func (j *Jobs) Commit() error
- func (j *Jobs) ExecuteAll(ctx context.Context, chainCtx *snow.ConsensusContext, halter common.Haltable, ...) (int, error)
- func (j *Jobs) Has(jobID ids.ID) (bool, error)
- func (j *Jobs) PendingJobs() uint64
- func (j *Jobs) Push(ctx context.Context, 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(ctx context.Context, job Job) (bool, error)
- func (jm *JobsWithMissing) RemoveMissingID(jobIDs ...ids.ID)
- func (jm *JobsWithMissing) SetParser(ctx context.Context, parser Parser) error
- type Parser
- type TestJob
- func (j *TestJob) Bytes() []byte
- func (j *TestJob) Default(cant bool)
- func (j *TestJob) Execute(ctx context.Context) error
- func (j *TestJob) HasMissingDependencies(ctx context.Context) (bool, error)
- func (j *TestJob) ID() ids.ID
- func (j *TestJob) MissingDependencies(ctx context.Context) (set.Set[ids.ID], error)
- type TestParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job interface { ID() ids.ID MissingDependencies(context.Context) (set.Set[ids.ID], error) // Returns true if this job has at least 1 missing dependency HasMissingDependencies(context.Context) (bool, error) Execute(context.Context) 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.4.5
func (*Jobs) PendingJobs ¶ added in v1.7.4
Returns how many pending jobs are waiting in the queue.
type JobsWithMissing ¶ added in v1.4.5
type JobsWithMissing struct { *Jobs // contains filtered or unexported fields }
func NewWithMissing ¶ added in v1.4.5
func NewWithMissing( db database.Database, metricsNamespace string, metricsRegisterer prometheus.Registerer, ) (*JobsWithMissing, error)
func (*JobsWithMissing) AddMissingID ¶ added in v1.4.5
func (jm *JobsWithMissing) AddMissingID(jobIDs ...ids.ID)
AddMissingID adds [jobID] to missingIDs
func (*JobsWithMissing) Clear ¶ added in v1.7.5
func (jm *JobsWithMissing) Clear() error
func (*JobsWithMissing) Commit ¶ added in v1.4.5
func (jm *JobsWithMissing) Commit() error
Commit the versionDB to the underlying database.
func (*JobsWithMissing) Has ¶ added in v1.4.5
func (jm *JobsWithMissing) Has(jobID ids.ID) (bool, error)
func (*JobsWithMissing) MissingIDs ¶ added in v1.4.5
func (jm *JobsWithMissing) MissingIDs() []ids.ID
func (*JobsWithMissing) NumMissingIDs ¶ added in v1.4.5
func (jm *JobsWithMissing) NumMissingIDs() int
func (*JobsWithMissing) Push ¶ added in v1.4.5
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.4.5
func (jm *JobsWithMissing) RemoveMissingID(jobIDs ...ids.ID)
RemoveMissingID removes [jobID] from missingIDs
type TestJob ¶
type TestJob struct { T *testing.T CantID, CantMissingDependencies, CantExecute, CantBytes, CantHasMissingDependencies bool IDF func() ids.ID MissingDependenciesF func(context.Context) (set.Set[ids.ID], error) ExecuteF func(context.Context) error BytesF func() []byte HasMissingDependenciesF func(context.Context) (bool, error) }
TestJob is a test Job
func (*TestJob) HasMissingDependencies ¶ added in v1.4.6
Click to show internal directories.
Click to hide internal directories.