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) Disable(name string)
- func (bo *BoolOptions) Dump()
- func (bo *BoolOptions) Enable(name string)
- func (bo *BoolOptions) GetFmtList() string
- func (bo *BoolOptions) GetFmtOpt(name string) string
- func (bo *BoolOptions) GetModel() *models.Configuration
- func (bo *BoolOptions) InheritDefault(parent *BoolOptions, key string)
- 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:"-"` }
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) Disable ¶
func (bo *BoolOptions) Disable(name string)
Disable disables the option `name`. All options which depend on the option to be disabled will be disabled. Options which have previously been enabled as a dependency will not be automatically disabled.
func (*BoolOptions) Dump ¶
func (bo *BoolOptions) Dump()
func (*BoolOptions) Enable ¶
func (bo *BoolOptions) Enable(name string)
Enable enables the option `name` with all its dependencies
func (*BoolOptions) GetFmtList ¶
func (bo *BoolOptions) GetFmtList() string
func (*BoolOptions) GetFmtOpt ¶
func (bo *BoolOptions) GetFmtOpt(name string) string
GetFmtOpt returns #define name if option exists and is set to true in endpoint's Opts map or #undef name if option does not exist or exists but is set to false
func (*BoolOptions) GetModel ¶
func (bo *BoolOptions) GetModel() *models.Configuration
func (*BoolOptions) InheritDefault ¶
func (bo *BoolOptions) InheritDefault(parent *BoolOptions, key string)
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