Documentation
¶
Index ¶
- Constants
- Variables
- func InstrumentMetrics()
- func Meter() metric.Meter
- func SetService(name string)
- func SetSystem(system string)
- func SetVersion(version string)
- func SystemAttributes() []attribute.KeyValue
- func Version() string
- func WithSystemAttributes() metric.MeasurementOption
- type Job
- type JobID
- type JobOpt
- type JobRunOpt
- type Runnable
- type RunnableFunc
- type Scheduler
Constants ¶
View Source
const ( OTelScopeName = "github.com/pelageech/atarax" MeterPrefix = "atarax." )
View Source
const ( Major = 0 Minor = 1 Patch = 0 )
Variables ¶
View Source
var ( ErrJobExists = errors.New("job already exists") ErrJobNotFound = errors.New("job not found") )
View Source
var ErrJobTimeout = errors.New("job timeout")
Functions ¶
func InstrumentMetrics ¶
func InstrumentMetrics()
func SetService ¶
func SetService(name string)
SetService configures atarax.service attribute for atarax.info.
func SetSystem ¶
func SetSystem(system string)
SetSystem configures atarax.system attribute for atarax.info.
func SetVersion ¶
func SetVersion(version string)
SetVersion configures atarax.version attribute for atarax.info.
func SystemAttributes ¶
func WithSystemAttributes ¶
func WithSystemAttributes() metric.MeasurementOption
Types ¶
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
type RunnableFunc ¶
type Scheduler ¶
type Scheduler interface {
// Jobs returns an iterator to all the jobs that the scheduler processes currently.
Jobs() iter.Seq2[JobID, *Job]
// Schedule starts scheduling tasks containing in the pool. It should be run synchronously.
//
// The function should return an error if the scheduling can't be completed anymore.
// Context cancellation should provide graceful shutdown for all the running jobs and then
// return an error from the context using [context.Cause].
//
// Task errors don't influence Scheduler error.
Schedule(context.Context) error
// Add adds a new job into the pool to schedule. If job's ID collides with
// another job containing in the pool, the function should return ErrJobExists.
Add(*Job) error
// Remove finds the job with a given ID and pulls it from the scheduling pool.
// If there's no the job with such ID, ErrJobNotFound is returned.
Remove(JobID) error
}
Scheduler is the interface for schedule periodically executing jobs. It contains the necessary minimum providing the Schedule function and an adaptivity.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
example
command
|
|
|
pkg
|
|
|
sync/lockfree
Package lockfree provides thread-safe lock-free structures.
|
Package lockfree provides thread-safe lock-free structures. |
|
timewheel
Package timewheel is a fork github.com/rfyiamcool/go-timewheel.
|
Package timewheel is a fork github.com/rfyiamcool/go-timewheel. |
Click to show internal directories.
Click to hide internal directories.