type Function interface {
SetTo(ctx context.Context, activate bool) error
}
a "function chain" is a chain of idempotent functions that enable or disable something. The chain will attempt to keep ALL functions enabled or disabled. In other words, it attempts to keep all functions either disabled or enabled.
type FunctionChain struct {
sync.Mutex
// contains filtered or unexported fields
}
func NewFunctionChain() *FunctionChain
func (fc *FunctionChain) Add(f Function) *function_ref
func (fc *FunctionChain) AddFuncs(enable, disable func(context.Context) error) *function_ref
shortcut: add a pair of enable/disable functions
func (fc *FunctionChain) AddSetter(setter func(context.Context, bool) error) *function_ref
shortcut: add a pair of enable/disable functions
func (fc *FunctionChain) Disable(ctx context.Context) error
func (fc *FunctionChain) Enable(ctx context.Context) error
func (fc *FunctionChain) SetTo(ctx context.Context, b bool) error