scheduler

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStore

func NewStore() *store.JobStore

Types

type Config

type Config struct {
	MaxFailures   uint64        `yaml:"compaction_max_failures" doc:""`
	LeaseDuration time.Duration `yaml:"compaction_job_lease_duration" doc:""`
	MaxQueueSize  uint64        `yaml:"compaction_max_job_queue_size" doc:""`
}

func (*Config) RegisterFlagsWithPrefix

func (c *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

type JobStore

type JobStore interface {
	StoreJobPlan(*bbolt.Tx, *raft_log.CompactionJobPlan) error
	GetJobPlan(tx *bbolt.Tx, name string) (*raft_log.CompactionJobPlan, error)
	DeleteJobPlan(tx *bbolt.Tx, name string) error

	StoreJobState(*bbolt.Tx, *raft_log.CompactionJobState) error
	DeleteJobState(tx *bbolt.Tx, name string) error
	ListEntries(*bbolt.Tx) iter.Iterator[*raft_log.CompactionJobState]

	CreateBuckets(*bbolt.Tx) error
}

JobStore does not really store jobs as they are: it explicitly distinguishes between the job and the job state.

Implementation note: block metadata should never be stored in StoreJob: those are already stored in the metadata index.

type Scheduler

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

func NewScheduler

func NewScheduler(config Config, store JobStore, reg prometheus.Registerer) *Scheduler

NewScheduler creates a scheduler with the given lease duration. Typically, callers should update jobs at the interval not exceeding the half of the lease duration.

func (*Scheduler) Init

func (sc *Scheduler) Init(tx *bbolt.Tx) error

func (*Scheduler) NewSchedule

func (sc *Scheduler) NewSchedule(tx *bbolt.Tx, cmd *raft.Log) compaction.Schedule

func (*Scheduler) Restore

func (sc *Scheduler) Restore(tx *bbolt.Tx) error

func (*Scheduler) UpdateSchedule

func (sc *Scheduler) UpdateSchedule(tx *bbolt.Tx, update *raft_log.CompactionPlanUpdate) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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