Documentation ¶
Overview ¶
Package config ...
Package config ...
Package config ...
Package config ...
Package config ...
Package config ...
Index ¶
- Variables
- type Config
- type Manager
- type ManagerInstance
- func (mi *ManagerInstance) Delete(key string) (*Value, error)
- func (mi *ManagerInstance) EnsureSet(key, defaults string) error
- func (mi *ManagerInstance) EnsureSetMany(cnf map[string]string) error
- func (mi *ManagerInstance) Etcd() etcdc.Client
- func (mi *ManagerInstance) Exists(key string) error
- func (mi *ManagerInstance) Get(key string) (*Value, error)
- func (mi *ManagerInstance) GetBasePrefix() string
- func (mi *ManagerInstance) GetBool(key string) (bool, error)
- func (mi *ManagerInstance) GetDuration(key string) (time.Duration, error)
- func (mi *ManagerInstance) GetOrSet(key, defaults string) (*Value, error)
- func (mi *ManagerInstance) GetString(key string) (string, error)
- func (mi *ManagerInstance) Init() (err error)
- func (mi *ManagerInstance) Set(key, value string) (*Value, error)
- func (mi *ManagerInstance) SetTTL(key, value string, ttl time.Duration) (*Value, error)
- func (mi *ManagerInstance) ShouldAutoSyncNodes() bool
- func (mi *ManagerInstance) SyncNodes(interval time.Duration) (err error)
- type Value
Constants ¶
This section is empty.
Variables ¶
var ( // ErrorInvalidEnv - ErrorInvalidEnv = "Could not find (key: env) within (config: %q). Plase make sure to read package documentation." // ErrorInvalidFolder - ErrorInvalidFolder = "Could not find (key: folder) within (config: %q). Plase make sure to read package documentation." // ErrorInvalidEtcdConfig - ErrorInvalidEtcdConfig = "Could not find (key: etcd) within (config: %q). Plase make sure to read package documentation." )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config interface { Get(key string) (*Value, error) GetOrSet(key, defaults string) (*Value, error) GetBool(key string) (bool, error) GetString(key string) (string, error) GetDuration(key string) (time.Duration, error) Set(key, value string) (*Value, error) SetTTL(key, value string, ttl time.Duration) (*Value, error) EnsureSet(key, defaults string) error EnsureSetMany(map[string]string) error Exists(key string) error Delete(key string) (*Value, error) }
Config - Basic CRUD operations against Etcd configuration path
type Manager ¶
type Manager interface { Config Etcd() etcdc.Client ShouldAutoSyncNodes() bool SyncNodes(interval time.Duration) error Init() error }
Manager -
type ManagerInstance ¶
type ManagerInstance struct { AutoSync bool Env string EtcdFolder string Version string Client etcdc.Client Kapi etcdc.KeysAPI }
ManagerInstance - Instance that manages configurations
func (*ManagerInstance) Delete ¶
func (mi *ManagerInstance) Delete(key string) (*Value, error)
Delete - Will delete etcd key. If there are no keys, will return error
func (*ManagerInstance) EnsureSet ¶
func (mi *ManagerInstance) EnsureSet(key, defaults string) error
EnsureSet - Will ensure that key is set. If it's not set, it will set key with provided defaults.
func (*ManagerInstance) EnsureSetMany ¶
func (mi *ManagerInstance) EnsureSetMany(cnf map[string]string) error
EnsureSetMany - Will recursively go over map of strings and ensure each of them is set.
func (*ManagerInstance) Etcd ¶
func (mi *ManagerInstance) Etcd() etcdc.Client
Etcd - Will return instance of CoreOS Etcd
func (*ManagerInstance) Exists ¶
func (mi *ManagerInstance) Exists(key string) error
Exists - Will check if key exists or not
func (*ManagerInstance) Get ¶
func (mi *ManagerInstance) Get(key string) (*Value, error)
Get - Will return etcd response about specified key. If there are no keys, will return error
func (*ManagerInstance) GetBasePrefix ¶
func (mi *ManagerInstance) GetBasePrefix() string
GetBasePrefix - Base prefix that will be used with new client api
func (*ManagerInstance) GetBool ¶
func (mi *ManagerInstance) GetBool(key string) (bool, error)
GetBool - Helper function that will try to fetch key from etcd and parse it as bool In case of any issues it will return error
func (*ManagerInstance) GetDuration ¶
func (mi *ManagerInstance) GetDuration(key string) (time.Duration, error)
GetDuration - Helper function that will try to fetch key from etcd and parse it as time.Duration In case of any issues it will return error
func (*ManagerInstance) GetOrSet ¶
func (mi *ManagerInstance) GetOrSet(key, defaults string) (*Value, error)
GetOrSet - Will attempt to retreive key from etcd and if one is not there, will attempt to create it
func (*ManagerInstance) GetString ¶
func (mi *ManagerInstance) GetString(key string) (string, error)
GetString - Helper function that will try to fetch key from etcd and parse it as string In case of any issues it will return error
func (*ManagerInstance) Init ¶
func (mi *ManagerInstance) Init() (err error)
Init - Will initialize important parts of the package such as etcd api
func (*ManagerInstance) Set ¶
func (mi *ManagerInstance) Set(key, value string) (*Value, error)
Set - Will set new etcd key. If there are no keys, will return error
func (*ManagerInstance) SetTTL ¶
SetTTL - Will set new expiration etcd key. If there are no keys, will return error
func (*ManagerInstance) ShouldAutoSyncNodes ¶
func (mi *ManagerInstance) ShouldAutoSyncNodes() bool
ShouldAutoSyncNodes - Basically return if we have permission to auto synchronize nodes or not. Used on package startup ...