batch_job

package
v1.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseConfig

type BaseConfig struct {
	Enabled    bool   `json:"enabled"`
	Interval   string `json:"interval"` // e.g. "10s", "1m", "1h"
	MaxRetries int64  `json:"maxRetries"`
}

func (*BaseConfig) ProcessingInterval

func (c *BaseConfig) ProcessingInterval() taskprocessor.ProcessingInterval

func (*BaseConfig) Validate

func (c *BaseConfig) Validate() error

Validate checks the correctness of the base config values.

type BatchJob

type BatchJob struct {
	BaseConfig
	// contains filtered or unexported fields
}

func NewBatchJob

func NewBatchJob(options ...BatchJobConfigOption) *BatchJob

func (*BatchJob) String

func (c *BatchJob) String() string

func (*BatchJob) Validate

func (c *BatchJob) Validate() error

type BatchJobConfigOption

type BatchJobConfigOption func(*BatchJob)

func WithBaseConfig

func WithBaseConfig(cfg BaseConfig) BatchJobConfigOption

func WithTask

func WithTask(task *asynq.Task) BatchJobConfigOption

func WithTaskId

func WithTaskId(taskId *string) BatchJobConfigOption

type BatchJobs

type BatchJobs struct {
	// contains filtered or unexported fields
}

func NewBatchJobs

func NewBatchJobs(options ...BatchJobsOption) *BatchJobs

func (*BatchJobs) AddJob

func (b *BatchJobs) AddJob(job *BatchJob)

AddJob appends a new BatchJob to the jobs slice.

type BatchJobsOption

type BatchJobsOption func(*BatchJobs)

func WithBatchJob

func WithBatchJob(batchJob *BatchJob) BatchJobsOption

WithBatchJobs sets the batch jobs for the batcher.

func WithBatchJobs

func WithBatchJobs(batchJobs *BatchJobs) BatchJobsOption

type Batcher

type Batcher struct {
	// contains filtered or unexported fields
}

func NewBatcher

func NewBatcher(options ...BatcherOption) *Batcher

NewBatcher creates a new batcher.

func (*Batcher) RegisterRecurringBatchJobs

func (b *Batcher) RegisterRecurringBatchJobs(ctx context.Context) error

RegisterRecurringBatchJobs registers all recurring batch jobs.

type BatcherOption

type BatcherOption func(*Batcher)

func WithBatchJobsRef

func WithBatchJobsRef(batchJobs *BatchJobs) BatcherOption

WithBatchJobs sets the batch jobs for the batcher.

func WithTaskProcessor

func WithTaskProcessor(processor *taskprocessor.TaskProcessor) BatcherOption

WithTaskProcessor sets the task processor for the batcher.

type Runnable

type Runnable interface {
	RegisterRecurringBatchJobs(ctx context.Context) error
}

Runnable is an interface that defines a method to register recurring batch jobs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL