Documentation ¶
Index ¶
- Variables
- type BackingLoader
- type BackingLoaderFunc
- type Bool
- type BoolWatch
- type DistInfo
- type DistType
- type Distconf
- func (c *Distconf) Bool(key string, defaultVal bool) *Bool
- func (c *Distconf) Close()
- func (c *Distconf) Duration(key string, defaultVal time.Duration) *Duration
- func (c *Distconf) Float(key string, defaultVal float64) *Float
- func (c *Distconf) Info() expvar.Var
- func (c *Distconf) Int(key string, defaultVal int64) *Int
- func (c *Distconf) Str(key string, defaultVal string) *Str
- func (c *Distconf) Var() expvar.Var
- type Duration
- type DurationWatch
- type Dynamic
- type Float
- type FloatWatch
- type Int
- type IntWatch
- type Reader
- type ReaderWriter
- type Str
- type StrWatch
- type Writer
- type ZkConfig
- type ZkConn
- type ZkConnector
- type ZkConnectorFunc
Constants ¶
This section is empty.
Variables ¶
var DefaultLogger = log.Logger(log.DefaultLogger.CreateChild())
DefaultLogger is used by package structs that don't have a default logger set.
var DefaultZkConfig = &ZkConfig{ Logger: DefaultLogger, }
DefaultZkConfig is the configuration used by new Zk readers if any config parameter is unset
Functions ¶
This section is empty.
Types ¶
type BackingLoader ¶
A BackingLoader should run a single time and get a Reader for Config
func CmdLoader ¶
func CmdLoader(prefix string) BackingLoader
CmdLoader is a loading helper for command line config variables
func EnvLoader ¶
func EnvLoader() BackingLoader
EnvLoader is a loading helper for Env{} config variables
func IniLoader ¶
func IniLoader(filename string) BackingLoader
IniLoader is a helper for loading from Ini files
type BackingLoaderFunc ¶
BackingLoaderFunc can wrap a function to turn it into a BackingLoader
func (BackingLoaderFunc) Get ¶
func (f BackingLoaderFunc) Get() (Reader, error)
Get a Reader for Config, or an error if the Reader cannot be loaded
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool is a Boolean type config inside a Config. It uses strconv.ParseBool to parse the conf contents as either true for false
type BoolWatch ¶
BoolWatch is executed if registered on a Bool variable any time the Bool contents change
type DistInfo ¶
type DistInfo struct { File string `json:"file"` Line int `json:"line"` DefaultValue interface{} `json:"default_value"` DistType DistType `json:"dist_type"` }
DistInfo is useful to unmarshal/marshal the Info expvar
type Distconf ¶
Distconf gets configuration data from the first backing that has it
func FromLoaders ¶
func FromLoaders(loaders []BackingLoader) *Distconf
FromLoaders creates a Config from an array of loaders, only using loaders that don't load with error
func (*Distconf) Bool ¶
Bool object that can be referenced to get boolean values from a backing config
func (*Distconf) Close ¶
func (c *Distconf) Close()
Close this config framework's readers. Config variable results are undefined after this call.
func (*Distconf) Duration ¶
Duration returns a duration object that calls ParseDuration() on the given key
func (*Distconf) Float ¶
Float object that can be referenced to get float values from a backing config
func (*Distconf) Info ¶
Info returns an expvar variable that shows the information for all configuration variables. Information consist of file, line, default value and type of variable.
func (*Distconf) Int ¶
Int object that can be referenced to get integer values from a backing config
type Duration ¶
type Duration struct {
// contains filtered or unexported fields
}
Duration is a duration type config inside a Config.
func (*Duration) Watch ¶
func (s *Duration) Watch(watch DurationWatch)
Watch adds a watch for changes to this structure
type DurationWatch ¶
DurationWatch is executed if registered on a Duration variable any time the contents change
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
Float is an float type config inside a Config.
type FloatWatch ¶
FloatWatch is called on any changes to a register integer config variable
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int is an integer type config inside a Config.
type Reader ¶
Reader can get a []byte value for a config key
func Cmd ¶
Cmd creates a backing reader that reads config varaibles from command line parameters with a prefix
type ReaderWriter ¶
A ReaderWriter can both read and write configuration information
func Zk ¶
func Zk(zkConnector ZkConnector, conf *ZkConfig) (ReaderWriter, error)
Zk creates a zookeeper readable backing
type Str ¶
type Str struct {
// contains filtered or unexported fields
}
Str is a string type config inside a Config.
type StrWatch ¶
StrWatch is executed if registered on a Str variable any time the Str contents change
type ZkConn ¶
type ZkConn interface { Exists(path string) (bool, *zk.Stat, error) Get(path string) ([]byte, *zk.Stat, error) GetW(path string) ([]byte, *zk.Stat, <-chan zk.Event, error) Create(path string, data []byte, flags int32, acl []zk.ACL) (string, error) Set(path string, data []byte, version int32) (*zk.Stat, error) ExistsW(path string) (bool, *zk.Stat, <-chan zk.Event, error) ChildrenW(path string) ([]string, *zk.Stat, <-chan zk.Event, error) Delete(path string, version int32) error Close() }
ZkConn does zookeeper connections
type ZkConnector ¶
ZkConnector creates zk connections for distconf