Documentation ¶
Index ¶
- func NormalizeBool(value string) (bool, error)
- func ParseOption(arg string, lib *OptionLibrary) (string, bool, error)
- type BoolOptions
- func (bo *BoolOptions) Apply(n models.ConfigurationMap, changed ChangedFunc, data interface{}) int
- func (bo *BoolOptions) DeepCopy() *BoolOptions
- func (bo *BoolOptions) Delete(key string)
- func (bo *BoolOptions) Dump()
- func (bo *BoolOptions) GetFmtList() string
- func (bo *BoolOptions) GetModel() *models.Configuration
- func (bo *BoolOptions) InheritDefault(parent *BoolOptions, key string)
- func (bo *BoolOptions) IsDisabled(key string) bool
- func (bo *BoolOptions) IsEnabled(key string) bool
- func (bo *BoolOptions) Set(key string, value bool)
- func (bo *BoolOptions) SetIfUnset(key string, value bool)
- func (bo *BoolOptions) Validate(n models.ConfigurationMap) error
- type ChangedFunc
- type Option
- type OptionLibrary
- type OptionMap
- type VerifyFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeBool ¶
func ParseOption ¶
func ParseOption(arg string, lib *OptionLibrary) (string, bool, error)
Types ¶
type BoolOptions ¶
type BoolOptions struct { Opts OptionMap `json:"map"` Library *OptionLibrary `json:"-"` // contains filtered or unexported fields }
func NewBoolOptions ¶
func NewBoolOptions(lib *OptionLibrary) *BoolOptions
func (*BoolOptions) Apply ¶
func (bo *BoolOptions) Apply(n models.ConfigurationMap, changed ChangedFunc, data interface{}) int
Apply takes a configuration map and applies the changes. For an option which is changed, the `ChangedFunc` function is called with the `data` argument passed in as well. Returns the number of options changed if any.
func (*BoolOptions) DeepCopy ¶
func (bo *BoolOptions) DeepCopy() *BoolOptions
func (*BoolOptions) Delete ¶
func (bo *BoolOptions) Delete(key string)
func (*BoolOptions) Dump ¶
func (bo *BoolOptions) Dump()
func (*BoolOptions) GetFmtList ¶
func (bo *BoolOptions) GetFmtList() string
func (*BoolOptions) GetModel ¶
func (bo *BoolOptions) GetModel() *models.Configuration
func (*BoolOptions) InheritDefault ¶
func (bo *BoolOptions) InheritDefault(parent *BoolOptions, key string)
func (*BoolOptions) IsDisabled ¶ added in v0.9.0
func (bo *BoolOptions) IsDisabled(key string) bool
func (*BoolOptions) IsEnabled ¶
func (bo *BoolOptions) IsEnabled(key string) bool
func (*BoolOptions) Set ¶
func (bo *BoolOptions) Set(key string, value bool)
func (*BoolOptions) SetIfUnset ¶
func (bo *BoolOptions) SetIfUnset(key string, value bool)
func (*BoolOptions) Validate ¶
func (bo *BoolOptions) Validate(n models.ConfigurationMap) error
Validate validates a given configuration map based on the option library
type ChangedFunc ¶
ChangedFunc is called by `Apply()` for each option changed
type Option ¶
type Option struct { // Define is the name of the #define used for BPF programs Define string // Description is a short human readable description Description string // Immutable marks an option which is read-only Immutable bool // Requires is a list of required options, such options will be // automatically enabled as required. Requires []string // Verify is called prior to applying the option Verify VerifyFunc }
Option is the structure used to specify the semantics of a configurable boolean option
func (Option) RequiresOption ¶
RequiresOption returns true if the option requires the specified option `name`.
type OptionLibrary ¶
func (OptionLibrary) Define ¶
func (l OptionLibrary) Define(name string) string
type VerifyFunc ¶
VerifyFunc validates option key with value and may return an error if the option should not be applied
Click to show internal directories.
Click to hide internal directories.