taskswitch

package
v0.0.0-...-303e327 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SwitchOpen  = "true"
	SwitchClose = "false"
)

Variables

View Source
var (
	ErrConflictSwitch = errors.New("switch has existed")
	ErrNoSuchSwitch   = errors.New("no such switch")
)

Functions

This section is empty.

Types

type ConfigGetter

type ConfigGetter interface {
	GetConfig(ctx context.Context, key string) (val string, err error)
}

type ISwitcher

type ISwitcher interface {
	Enabled() bool
	WaitEnable()
}

type SwitchMgr

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

func NewSwitchMgr

func NewSwitchMgr(cmCli ConfigGetter) *SwitchMgr

func (*SwitchMgr) AddSwitch

func (sm *SwitchMgr) AddSwitch(switchName string) (*TaskSwitch, error)

func (*SwitchMgr) DelSwitch

func (sm *SwitchMgr) DelSwitch(switchName string) error

type TaskSwitch

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

func NewEnabledTaskSwitch

func NewEnabledTaskSwitch() *TaskSwitch

func (*TaskSwitch) Disable

func (s *TaskSwitch) Disable()

func (*TaskSwitch) Enable

func (s *TaskSwitch) Enable()

func (*TaskSwitch) Enabled

func (s *TaskSwitch) Enabled() bool

func (*TaskSwitch) WaitEnable

func (s *TaskSwitch) WaitEnable()

Jump to

Keyboard shortcuts

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