Documentation
¶
Index ¶
- Variables
- type ConfigWithMeta
- type Registry
- func (r *Registry) GetRegisteredNames() []string
- func (r *Registry) GetReloadable(name string) Reloadable
- func (r *Registry) GetReloadableList(name string) ReloadableList
- func (r *Registry) MustRegister(name string, obj Reloadable)
- func (r *Registry) MustRegisterList(name string, list ReloadableList)
- func (r *Registry) Register(name string, obj Reloadable) error
- func (r *Registry) RegisterList(name string, list ReloadableList) error
- type Reloadable
- type ReloadableFunc
- type ReloadableList
Constants ¶
This section is empty.
Variables ¶
var Register = NewRegistry()
Register holds a registry of reloadable objects
Functions ¶
This section is empty.
Types ¶
type ConfigWithMeta ¶
type ConfigWithMeta struct { // Config to store Config *config.Config // Meta data related to this config Meta *util.MapStrPointer }
ConfigWithMeta holds a pair of common.Config and optional metadata for it
type Registry ¶
Registry of reloadable objects and lists
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry initializes and returns a reload registry
func (*Registry) GetRegisteredNames ¶
GetRegisteredNames returns the list of names registered
func (*Registry) GetReloadable ¶
func (r *Registry) GetReloadable(name string) Reloadable
GetReloadable returns the reloadable object with the given name, nil if not found
func (*Registry) GetReloadableList ¶
func (r *Registry) GetReloadableList(name string) ReloadableList
GetReloadableList returns the reloadable list with the given name, nil if not found
func (*Registry) MustRegister ¶
func (r *Registry) MustRegister(name string, obj Reloadable)
MustRegister declares a reloadable object
func (*Registry) MustRegisterList ¶
func (r *Registry) MustRegisterList(name string, list ReloadableList)
MustRegisterList declares a reloadable object list
func (*Registry) Register ¶
func (r *Registry) Register(name string, obj Reloadable) error
Register declares a reloadable object
func (*Registry) RegisterList ¶
func (r *Registry) RegisterList(name string, list ReloadableList) error
RegisterList declares a reloadable list of configurations
type Reloadable ¶
type Reloadable interface {
Reload(config *ConfigWithMeta) error
}
Reloadable provides a method to reload the configuration of an entity
type ReloadableFunc ¶
type ReloadableFunc func(config *ConfigWithMeta) error
ReloadableFunc wraps a custom function in order to implement the Reloadable interface.
func (ReloadableFunc) Reload ¶
func (fn ReloadableFunc) Reload(config *ConfigWithMeta) error
Reload calls the underlying function.
type ReloadableList ¶
type ReloadableList interface {
Reload(configs []*ConfigWithMeta) error
}
ReloadableList provides a method to reload the configuration of a list of entities