Documentation ¶
Overview ¶
This is a convenience package for supplying configuration parameters and applying metadata to a BOSSWAVE driver which provides services and interfaces.
The following keys are expected and used by spawnable:
- svc_base_uri: the full BOSSWAVE URI prefix for where this driver will be deployed
- metadata: tiered map of key-value pairs to be applied to different levels in the driver URI hierarchy
- metavalid: string formatted like "2006-01-02T15:04:05 MST" specifying when the metadata was considered valid
Metadata ¶
Metadata in spawnable is applied as a set of key-value pairs persisted at some URI. The URIs specified in the file are relative to `svc_base_uri`.
Example:
# params.yml metadata: - s.servicename: - key1: value1 - key2: value2 - s.servicename/instance: - key3: value3 - s.servicename/instance/i.name: - key4: value4 - key5: value5
If `svc_base_uri` was `scratch.ns/services`, then metadata would be placed at the following URIs:
scratch.ns/services/s.servicename/!meta/key1 scratch.ns/services/s.servicename/!meta/key2 scratch.ns/services/s.servicename/instance/!meta/key3 scratch.ns/services/s.servicename/instance/i.name/!meta/key4 scratch.ns/services/s.servicename/instance/i.name/!meta/key5
Inheritance of this metadata is dictated by the semantics of the BOSSWAVE query tool, which will "trickle down" metadata from prefixes to the longer URIs.
Index ¶
- type MetaTuple
- type Params
- func (p *Params) GetEntity() (blob []byte, err error)
- func (p *Params) GetEntityOrExit() (blob []byte)
- func (p *Params) MergeMetadata(cl *bw2bind.BW2Client)
- func (p *Params) MergeMetadataOnURI(md []*MetaTuple, uriSuffix string, cl *bw2bind.BW2Client)
- func (p *Params) MustInt(key string) int
- func (p *Params) MustString(key string) string
- func (p *Params) MustStringSlice(key string) []string
- func (p *Params) ParamsMetadataFromURI(uriSuffix string) []*MetaTuple
- type SmartPoller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetaTuple ¶
type Params ¶
type Params struct {
// contains filtered or unexported fields
}
Key value structure representing the paramater file
func GetParamsFile ¶
Loads parameters from the given YAML file
func GetParamsFileOrExit ¶
Loads parameters from the given YAML file or exits
func (*Params) GetEntityOrExit ¶
func (*Params) MergeMetadata ¶
func (p *Params) MergeMetadata(cl *bw2bind.BW2Client)
Applies metadata from the different suffixes in the params to their respective URIs
func (*Params) MergeMetadataOnURI ¶
given a k/v map of metadata, applies these as MetadataTuples on the given uriSuffix, which will be prefixed with `svc_base_uri`, considered valid from the time provided in `metavalid`
func (*Params) MustString ¶
func (*Params) MustStringSlice ¶
func (*Params) ParamsMetadataFromURI ¶
pulls the k/v pairs from the given URI suffix under the 'metadata' tag in params
type SmartPoller ¶
type SmartPoller struct {
// contains filtered or unexported fields
}
func NewSmartPoller ¶
func NewSmartPoller(minInterval, maxInterval, adjust time.Duration, cb func()) *SmartPoller
A smart poller will call cb every interval, and double the interval every adjust, up to maxInterval. If reset(), the interval goes down to minInterval
func (*SmartPoller) Reset ¶
func (sp *SmartPoller) Reset()