Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct {
Type Type `yaml:"type"`
DefaultValue *bool `yaml:"defaultValue"`
RuntimeKey string `yaml:"runtimeKey" validate:"nonzero"`
InitTimeout *time.Duration `yaml:"initTimeout"`
}
Configuration configures the traffic controller.
func (*Configuration) NewTrafficController ¶
func (c *Configuration) NewTrafficController( store kv.Store, instrumentOpts instrument.Options, ) (Controller, error)
NewTrafficController creates a new traffic controller.
type Controller ¶
type Controller interface {
// Allow returns true if traffic is allowed.
Allow() bool
// Init initializes the traffic controller to watch the runtime updates.
Init() error
// Close closes the traffic controller.
Close()
}
Controller controls traffic.
func NewTrafficDisabler ¶
func NewTrafficDisabler(opts Options) Controller
NewTrafficDisabler creates a new traffic disabler.
func NewTrafficEnabler ¶
func NewTrafficEnabler(opts Options) Controller
NewTrafficEnabler creates a new traffic enabler.
type Options ¶
type Options interface {
// SetStore sets the kv store.
SetStore(store kv.Store) Options
// Store returns the kv store.
Store() kv.Store
// SetDefaultValue sets the default value.
SetDefaultValue(value bool) Options
// DefaultValue returns the default value.
DefaultValue() bool
// SetRuntimeKey sets the runtime enable key,
// which will override the default enabled value when present.
SetRuntimeKey(value string) Options
// RuntimeKey returns the runtime enable key,
// which will override the default enabled value when present.
RuntimeKey() string
// SetInitTimeout sets the init timeout.
SetInitTimeout(value time.Duration) Options
// InitTimeout returns the init timeout.
InitTimeout() time.Duration
// SetInstrumentOptions sets the instrument options.
SetInstrumentOptions(value instrument.Options) Options
// InstrumentOptions returns the instrument options.
InstrumentOptions() instrument.Options
}
Options configurates the traffic controller.
type Type ¶
type Type string
Type defines the type of the traffic controller.
func (*Type) UnmarshalYAML ¶
UnmarshalYAML unmarshals TrafficControllerType from yaml.
Click to show internal directories.
Click to hide internal directories.