Documentation ¶
Index ¶
- Variables
- func Diff(a, b string) (string, error)
- func Edit(src string, mode EditMode, ref Referrer) error
- type Alert
- type AlertKind
- type AlertLevel
- type Alerts
- type Converter
- type EditMode
- type ErrPostponedRef
- type Referrer
- type T
- func (t T) Changed() bool
- func (t *T) Commit() error
- func (t *T) CommitData(configData rawconfig.T) error
- func (t *T) CommitDataTo(configData rawconfig.T, configPath string) error
- func (t *T) CommitDataToInvalid(configData rawconfig.T, configPath string) error
- func (t *T) CommitInvalid() error
- func (t *T) CommitTo(configPath string) error
- func (t *T) CommitToInvalid(configPath string) error
- func (t *T) DeleteSections(sections ...string) error
- func (t *T) DriverGroupSet(op keyop.T) error
- func (t *T) Eval(k key.T) (interface{}, error)
- func (t *T) EvalAs(k key.T, impersonate string) (interface{}, error)
- func (t *T) EvalAsNoConv(k key.T, impersonate string) (string, error)
- func (t *T) EvalKeywordAs(k key.T, kw keywords.Keyword, impersonate string) (interface{}, error)
- func (t *T) EvalNoConv(k key.T) (string, error)
- func (t *T) Get(k key.T) string
- func (t *T) GetBool(k key.T) bool
- func (t *T) GetBoolStrict(k key.T) (bool, error)
- func (t *T) GetDuration(k key.T) *time.Duration
- func (t *T) GetDurationStrict(k key.T) (*time.Duration, error)
- func (t *T) GetInt(k key.T) int
- func (t *T) GetIntStrict(k key.T) (int, error)
- func (t *T) GetSize(k key.T) *int64
- func (t *T) GetSizeStrict(k key.T) (*int64, error)
- func (t *T) GetStrict(k key.T) (string, error)
- func (t *T) GetString(k key.T) string
- func (t *T) GetStringAs(k key.T, impersonate string) string
- func (t *T) GetStringStrict(k key.T) (string, error)
- func (t *T) GetStringStrictAs(k key.T, impersonate string) (string, error)
- func (t *T) GetStrings(k key.T) []string
- func (t *T) GetStringsStrict(k key.T) ([]string, error)
- func (t *T) HasKey(k key.T) bool
- func (t *T) HasKeyMatchingOp(kop keyop.T) bool
- func (t T) HasSectionString(s string) bool
- func (t *T) IsInDRPNodes(impersonate string) (bool, error)
- func (t *T) IsInEncapNodes(impersonate string) (bool, error)
- func (t *T) IsInNodes(impersonate string) (bool, error)
- func (t *T) Keys(section string) []string
- func (t *T) LoadRaw(configData rawconfig.T) error
- func (t T) ModTime() time.Time
- func (t T) NewAlertCandidates(k key.T, did driver.ID, comment string) Alert
- func (t T) NewAlertCapabilities(k key.T, did driver.ID) Alert
- func (t T) NewAlertDeprecated(k key.T, did driver.ID, release, replacedBy string) Alert
- func (t T) NewAlertEval(k key.T, did driver.ID, comment string) Alert
- func (t T) NewAlertScoping(k key.T, did driver.ID) Alert
- func (t T) NewAlertUnknown(k key.T, did driver.ID) Alert
- func (t T) NewAlertUnknownDriver(k key.T, did driver.ID) Alert
- func (t T) Ops() []string
- func (t *T) PrepareDeleteSections(sections ...string) error
- func (t *T) PrepareSet(kops ...keyop.T) error
- func (t *T) PrepareUnset(ks ...key.T) error
- func (t *T) PrepareUpdate(deleteSections []string, unsetKeys []key.T, keyOps []keyop.T) error
- func (t T) Raw() rawconfig.T
- func (t T) RawEvaluated() (rawconfig.T, error)
- func (t T) RawEvaluatedAs(impersonate string) (rawconfig.T, error)
- func (t *T) Recommit() error
- func (t *T) RecommitInvalid() error
- func (t *T) RegisterPostCommit(fn func() error)
- func (t T) Reload() error
- func (t T) SectionMap(section string) map[string]string
- func (t T) SectionMapStrict(section string) (map[string]string, error)
- func (t T) SectionSig(section string) string
- func (t T) SectionStrings() []string
- func (t *T) SectionType(k key.T) string
- func (t *T) Set(ops ...keyop.T) error
- func (t *T) Unset(ks ...key.T) error
- func (t *T) Update(deleteSections []string, unsetKeys []key.T, keyOps []keyop.T) error
- func (t T) Validate() (Alerts, error)
- type TNodesConverter
- type TOtherNodesConverter
Constants ¶
This section is empty.
Variables ¶
var ( NodesConverter TNodesConverter OtherNodesConverter TOtherNodesConverter )
var ( ErrEditPending = errors.New(`the configuration is already being edited (--discard to edit from the installed configuration or --recover to edit the unapplied config)`) ErrEditValidate = errors.New("configuration validation error") )
var ( RegexpOperation = regexp.MustCompile(`(\$\(\(.+\)\))`) ErrExist = errors.New("configuration does not exist") ErrNoKeyword = errors.New("keyword does not exist") ErrType = errors.New("type error") DriverGroups = set.New("ip", "volume", "disk", "fs", "share", "container", "app", "sync", "task") )
Functions ¶
Types ¶
type Alert ¶
type Alert struct { Path naming.Path `json:"path"` Level AlertLevel `json:"level"` Kind AlertKind `json:"kind"` Key key.T `json:"key"` Driver driver.ID `json:"driver"` Comment string `json:"comment"` }
func (Alert) StringWithoutMeta ¶
type AlertKind ¶
type AlertKind int
func (AlertKind) MarshalJSON ¶
func (*AlertKind) UnmarshalJSON ¶
UnmarshalJSON unmashals a quoted json string to the enum value
type AlertLevel ¶
type AlertLevel int
func (AlertLevel) MarshalJSON ¶
func (t AlertLevel) MarshalJSON() ([]byte, error)
func (AlertLevel) String ¶
func (t AlertLevel) String() string
func (*AlertLevel) UnmarshalJSON ¶
func (t *AlertLevel) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type ErrPostponedRef ¶
func NewErrPostponedRef ¶
func NewErrPostponedRef(ref string, rid string) ErrPostponedRef
func (ErrPostponedRef) Error ¶
func (t ErrPostponedRef) Error() string
type Referrer ¶
type Referrer interface { KeywordLookup(key.T, string) keywords.Keyword IsVolatile() bool Config() *T // for reference private to the referrer. ex: path for an object Dereference(string) (string, error) // for scoping Nodes() ([]string, error) DRPNodes() ([]string, error) }
Referrer is the interface implemented by node and object to provide a reference resolver using their private attributes.
type T ¶
type T struct { ConfigFilePath string Path naming.Path Referrer Referrer NodeReferrer Referrer // contains filtered or unexported fields }
T exposes methods to read and write configurations.
func NewObject ¶
NewObject configures and returns a T instance pointer. The first argument is the path of the configuration file to write to.
The path must be repeated as one of the following sources to read it. Accepted sources are []byte in ini format or a configuration file path containing ini formatted data.
func (*T) CommitDataToInvalid ¶
func (*T) CommitInvalid ¶
func (*T) CommitToInvalid ¶
func (*T) DeleteSections ¶
DeleteSections deletes sections from the config and commit changes
func (*T) EvalAs ¶
EvalAs returns a key value,
- contextualized for a node (by default the local node, customized by the impersonate option)
- dereferenced
- evaluated
func (*T) EvalKeywordAs ¶
func (*T) GetInt ¶
GetInt returns the evaluated integer value associated with a key k. On errors returns 0.
func (*T) GetIntStrict ¶
GetIntStrict returns the evaluated integer value associated with a key k. On errors returns 0 and an appropriate error.
func (*T) GetStringStrictAs ¶
func (T) HasSectionString ¶
func (T) NewAlertCandidates ¶
func (T) NewAlertDeprecated ¶
func (T) Ops ¶
Ops returns the list of <section>.<option>[@<scope>]=<value> This format is used by the volume pools framework.
func (*T) PrepareDeleteSections ¶
PrepareDeleteSections deletes sections from the config without committing changes.
func (*T) PrepareSet ¶
PrepareSet applies key operations to config without committing changes.
func (*T) PrepareUnset ¶
PrepareUnset unsets keywords from config without committing changes.
func (*T) PrepareUpdate ¶
PrepareUpdate applies:
1- delete sections 2- unset keywords 3- apply key operations
without committing changes.
func (*T) RecommitInvalid ¶
func (*T) RegisterPostCommit ¶
func (T) SectionSig ¶
func (T) SectionStrings ¶
SectionStrings returns list of section names.
type TNodesConverter ¶
type TNodesConverter string
TNodesConverter is the type of converter used for the nodes keyword, which makes sure the local nodename is in the resulting []string.
func (TNodesConverter) Convert ¶
func (t TNodesConverter) Convert(s string) (interface{}, error)
func (TNodesConverter) String ¶
func (t TNodesConverter) String() string
type TOtherNodesConverter ¶
type TOtherNodesConverter string
TOtherNodesConverter is the type of converter used for the drpnodes and encapnodes keyword, which accepts to return an empty list.
func (TOtherNodesConverter) Convert ¶
func (t TOtherNodesConverter) Convert(s string) (interface{}, error)
func (TOtherNodesConverter) String ¶
func (t TOtherNodesConverter) String() string