Documentation ¶
Overview ¶
configio defines a generic interface for config management
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callback ¶
type Callback struct { Func func(ctx context.Context, data interface{}, err error) <-chan error Data interface{} Err error Chan chan struct{} }
Callback is the bookkeeping data for each registered callback
type Config ¶
Config defines the behavior of a type that can act as a config parameter Any such type should provide serialization methods and ability to get a key
type ConfigManager ¶
type ConfigManager interface { // Unmarshal unmarshals into marshaler Unmarshal(config Config) error // Marshal marshals data in marshaler Marshal(config Config) error io.Closer }
ConfigManager defines an interface to perform read/write on config params
type ConfigManagerWithWatch ¶
type ConfigManagerWithWatch interface { // Unmarshal unmarshals into marshaler Unmarshal(config Config) error // Marshal marshals data in marshaler Marshal(config Config) error // Watch registers a callback function Watch(name string, data interface{}, f func(ctx context.Context, data interface{}, err error) <-chan error) <-chan struct{} io.Closer }
ConfigManagerWithWatch defines an interface to access config params
type ConfigReader ¶
type ConfigReader interface { // Unmarshal unmarshals into marshaler Unmarshal(config Config) error io.Closer }
ConfigReader defines an interface to perform read operation on config params
type ConfigWatcher ¶
type ConfigWatcher interface { // Watch registers a callback function Watch(name string, data interface{}, f func(ctx context.Context, data interface{}, err error) <-chan error) <-chan struct{} io.Closer }
ConfigWatcher defines an interface to perform a watch on config changes. Watch registers a function that gets executed on config changes. If an error occurs on function execution, the function is called again with that error passed in as an input argument and is removed from the registry