Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrJobTypeAlreadyRegistered is returned when trying to register a job type that is already registered ErrJobTypeAlreadyRegistered = errors.New("job type already registered") )
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface {
// BuildJobs builds new jobs and sends them to the provided channel
// It should be a blocking call and returns when ctx is cancelled.
BuildJobs(ctx context.Context, jobsChan chan<- *grpc.Job)
// OnJobResponse reports back the response of the job execution.
OnJobResponse(response *grpc.JobResult) error
// JobsLeft reports the estimated number of jobs left to process.
// It should be updated when jobs are successfully processed or new work is picked up for execution.
// It should include in-flight and upcoming jobs even if they are created on-demand.
// It could just estimate jobs left to be processed for concluding ongoing unit of work.
// The implementation must be concurrency safe.
JobsLeft() int
}
Builder defines the interface for building jobs that will be added to the queue
type CompactorClient ¶
type CompactorClient interface {
JobQueueClient() grpc.JobQueueClient
}
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue implements the job queue service
func (*Queue) RegisterBuilder ¶
func (q *Queue) RegisterBuilder(jobType grpc.JobType, b Builder, jobTimeout time.Duration, maxRetries int, r prometheus.Registerer) error
RegisterBuilder registers a builder for a specific job type
type WorkerConfig ¶
type WorkerConfig struct {
NumWorkers int `yaml:"num_sub_workers"`
}
func (*WorkerConfig) RegisterFlags ¶
func (c *WorkerConfig) RegisterFlags(f *flag.FlagSet)
func (*WorkerConfig) RegisterFlagsWithPrefix ¶
func (c *WorkerConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)
func (*WorkerConfig) Validate ¶
func (c *WorkerConfig) Validate() error
type WorkerManager ¶
type WorkerManager struct {
// contains filtered or unexported fields
}
func NewWorkerManager ¶
func NewWorkerManager(cfg WorkerConfig, grpcClient CompactorClient, r prometheus.Registerer) *WorkerManager
func (*WorkerManager) RegisterJobRunner ¶
func (w *WorkerManager) RegisterJobRunner(jobType grpc.JobType, jobRunner JobRunner) error
Click to show internal directories.
Click to hide internal directories.