Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigRegistry ¶ added in v0.2.4
type ConfigRegistry interface { // Register should register the given Registry to be load/save/apply Register(registry Registry) // Load should restore the configurations from the backing storage Load() error // Save should save the configurations to the backing storage Save() error // Apply should instruct each Registry to apply the configurations Apply() error // Close should instruct each Registry to close/clean up Close() }
ConfigRegistry defines an interface to save/load/apply configs in each Registry
func NewDryRegistryHelper ¶ added in v0.2.4
func NewDryRegistryHelper() (ConfigRegistry, error)
NewDryRegistryHelper returns a helper to persist config to the Registry but without actual IO to save
func NewRegistryConfigHelper ¶ added in v0.4.0
func NewRegistryConfigHelper() (ConfigRegistry, error)
NewRegistryConfigHelper returns a helper to persist config to the Registry
type Registry ¶
type Registry interface { // Name should return the name of the configuration Name() string // Value should return the values to be persisted in binary format Value() []byte // Load should load the binary returned by Value() and populate the configuration Load([]byte) error // Apply should re-apply configurations Apply() error // Close should handle graceful shutdown (e.g. closing sockets, etc) Close() error }
Registry provides an interface for different configurations to save to Registry and reload
type RegistryConfigHelper ¶ added in v0.4.0
type RegistryConfigHelper struct {
// contains filtered or unexported fields
}
RegistryConfigHelper contains a list of configurations to be loaded, saved, and applied
func (*RegistryConfigHelper) Apply ¶ added in v0.4.0
func (h *RegistryConfigHelper) Apply() error
Apply will apply each config accordingly. This is usually called after Load()
func (*RegistryConfigHelper) Close ¶ added in v0.4.0
func (h *RegistryConfigHelper) Close()
Close will release resources of each config
func (*RegistryConfigHelper) Load ¶ added in v0.4.0
func (h *RegistryConfigHelper) Load() error
Load will retrive and populate configs from Registry
func (*RegistryConfigHelper) Register ¶ added in v0.4.0
func (h *RegistryConfigHelper) Register(config Registry)
Register will add the config to the list
func (*RegistryConfigHelper) Save ¶ added in v0.4.0
func (h *RegistryConfigHelper) Save() error
Save will persist all the configs to Registry as binary values