cyclemanager

package
v1.20.6 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: BSD-3-Clause Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CycleFunc

type CycleFunc func(shouldBreak ShouldBreakFunc) bool

return value indicates whether actual work was done in the cycle

type CycleManager

type CycleManager interface {
	Register(cycleFunc CycleFunc) UnregisterFunc
	Start()
	Stop(ctx context.Context) chan bool
	StopAndWait(ctx context.Context) error
	Running() bool
}

func NewMulti added in v1.19.6

func NewMulti(cycleTicker CycleTicker) CycleManager

func NewNoop added in v1.19.6

func NewNoop() CycleManager

type CycleTicker added in v1.18.3

type CycleTicker interface {
	Start()
	Stop()
	C() <-chan time.Time
	// called with bool value whenever cycle function finished execution
	// true - indicates cycle function actually did some processing
	// false - cycle function returned without doing anything
	CycleExecuted(executed bool)
}

func CompactionCycleTicker added in v1.18.3

func CompactionCycleTicker() CycleTicker

3s . 6.8s .. 14.4s .... 29.6s ........ 60s

func GeoCommitLoggerCycleTicker added in v1.18.3

func GeoCommitLoggerCycleTicker() CycleTicker

10s . 13.3s .. 20s .... 33.3s ........ 60s

func HnswCommitLoggerCycleTicker added in v1.18.3

func HnswCommitLoggerCycleTicker() CycleTicker

500ms . 806ms .. 1.42s .... 2.65s ........ 5.1s ................10s

func MemtableFlushCycleTicker added in v1.18.3

func MemtableFlushCycleTicker() CycleTicker

100ms . 258ms .. 574ms .... 1.206s ........ 2.471s ................ 5s

func NewExpTicker added in v1.18.3

func NewExpTicker(minInterval, maxInterval time.Duration, base, steps uint) CycleTicker

Creates ticker with intervals between minInterval and maxInterval values. Number of intervals in-between is determined by steps value. Ticker starts with minInterval value and with every report of executed "false" changes interval value to next one, up until maxInterval. Report of executed "true" resets interval to minInterval Example: for minInterval = 100ms, maxInterval = 5s, base = 2, steps = 4, intervals are 100ms . 427ms .. 1080ms .... 2387ms ........ 5000ms

If min- or maxInterval is <= 0 or base = 0 or steps = 0 or min > maxInterval, ticker will not fire

func NewFixedIntervalTicker added in v1.18.3

func NewFixedIntervalTicker(interval time.Duration) CycleTicker

Creates ticker with fixed interval. Interval is not changed regardless of execution results reported by cycle function

If interval <= 0 given, ticker will not fire

func NewLinearTicker added in v1.18.3

func NewLinearTicker(minInterval, maxInterval time.Duration, steps uint) CycleTicker

Creates ticker with intervals between minInterval and maxInterval values. Number of intervals in-between is determined by steps value. Ticker starts with minInterval value and with every report of executed "false" changes interval value to next one, up until maxInterval. Report of executed "true" resets interval to minInterval Example: for minInterval = 100ms, maxInterval = 5s, steps = 4, intervals are 100ms . 1325ms . 2550ms . 3775ms . 5000ms

If min- or maxInterval is <= 0 or steps = 0 or min > maxInterval, ticker will not fire

func NewNoopTicker added in v1.18.3

func NewNoopTicker() CycleTicker

func NewSeriesTicker added in v1.18.3

func NewSeriesTicker(intervals []time.Duration) CycleTicker

Creates ticker with set of interval values. Ticker starts with intervals[0] value and with every report of executed "false" changes interval value to next one in given array up until last one. Report of executed "true" resets interval to interval[0]

If any of intervals given is <= 0 given, ticker will not fire

type FixedIntervalTicker added in v1.18.3

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

func (*FixedIntervalTicker) C added in v1.18.3

func (t *FixedIntervalTicker) C() <-chan time.Time

func (*FixedIntervalTicker) CycleExecuted added in v1.18.3

func (t *FixedIntervalTicker) CycleExecuted(executed bool)

func (*FixedIntervalTicker) Start added in v1.18.3

func (t *FixedIntervalTicker) Start()

func (*FixedIntervalTicker) Stop added in v1.18.3

func (t *FixedIntervalTicker) Stop()

type NoopTicker added in v1.18.3

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

func (*NoopTicker) C added in v1.18.3

func (t *NoopTicker) C() <-chan time.Time

func (*NoopTicker) CycleExecuted added in v1.18.3

func (t *NoopTicker) CycleExecuted(executed bool)

func (*NoopTicker) Start added in v1.18.3

func (t *NoopTicker) Start()

func (*NoopTicker) Stop added in v1.18.3

func (t *NoopTicker) Stop()

type SeriesTicker added in v1.18.3

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

func (*SeriesTicker) C added in v1.18.3

func (t *SeriesTicker) C() <-chan time.Time

func (*SeriesTicker) CycleExecuted added in v1.18.3

func (t *SeriesTicker) CycleExecuted(executed bool)

func (*SeriesTicker) Start added in v1.18.3

func (t *SeriesTicker) Start()

func (*SeriesTicker) Stop added in v1.18.3

func (t *SeriesTicker) Stop()

type ShouldBreakFunc added in v1.18.3

type ShouldBreakFunc func() bool

indicates whether cyclemanager's stop was requested to allow safely break execution of CycleFunc and stop cyclemanager earlier

type UnregisterFunc added in v1.19.6

type UnregisterFunc func(ctx context.Context) error

Jump to

Keyboard shortcuts

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