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 ¶
func (*Jobs) PendingJobs ¶
Returns how many pending jobs are waiting in the queue.
type JobsWithMissing ¶
type JobsWithMissing struct { *Jobs // contains filtered or unexported fields }
func NewWithMissing ¶
func NewWithMissing( db database.Database, metricsNamespace string, metricsRegisterer prometheus.Registerer, ) (*JobsWithMissing, error)
func (*JobsWithMissing) AddMissingID ¶
func (jm *JobsWithMissing) AddMissingID(jobIDs ...ids.ID)
AddMissingID adds [jobID] to missingIDs
func (*JobsWithMissing) Clear ¶
func (jm *JobsWithMissing) Clear() error
func (*JobsWithMissing) Commit ¶
func (jm *JobsWithMissing) Commit() error
Commit the versionDB to the underlying database.
func (*JobsWithMissing) MissingIDs ¶
func (jm *JobsWithMissing) MissingIDs() []ids.ID
func (*JobsWithMissing) NumMissingIDs ¶
func (jm *JobsWithMissing) NumMissingIDs() int
func (*JobsWithMissing) Push ¶
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 ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.