cyclemanager

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: BSD-3-Clause Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultLSMCompactionInterval = 3 * time.Second
	DefaultMemtableFlushInterval = 500 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CycleFunc

type CycleFunc func(StopFunc)

type CycleManager

type CycleManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(cycleInterval time.Duration, cycleFunc CycleFunc) *CycleManager

func (*CycleManager) Running

func (c *CycleManager) Running() bool

func (*CycleManager) Start

func (c *CycleManager) Start()

Starts instance, does not block Does nothing if instance is already started

func (*CycleManager) Stop

func (c *CycleManager) Stop(ctx context.Context) (stopResult chan bool)

Stops running instance, does not block Returns channel with final stop result - true / false

If given context is cancelled before it is handled by stop logic, instance is not stopped If called multiple times, all contexts have to be cancelled to cancel stop (any valid will result in stopping instance) stopResult is the same (consistent) for multiple calls

func (*CycleManager) StopAndWait

func (c *CycleManager) StopAndWait(ctx context.Context) error

Stops running instance, waits for stop to occur or context to expire (which comes first) Returns error if instance was not stopped

type StopFunc

type StopFunc func() bool

Jump to

Keyboard shortcuts

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