Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotFound = errors.New("Config not found")
)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Key string `json:"key"` RawValue json.RawMessage `json:"value"` // contains filtered or unexported fields }
Config is the struct configmanager expects the configuration to be. When the file configs.json is parsed, State manager expects an array of this struct.
type DummyStateManager ¶
type DummyStateManager struct { *NullStateManager // contains filtered or unexported fields }
DummyStateManager is a statemanager which allows for raw configs to be set and retrieved
func NewDummyStateManager ¶
func NewDummyStateManager() *DummyStateManager
NewDummyStateManager returns a new instance of DummyStateManager
func (*DummyStateManager) GetKey ¶
func (d *DummyStateManager) GetKey(key string) (*Config, error)
GetKey returns the Config struct stored in memory
func (*DummyStateManager) SetConfig ¶
func (d *DummyStateManager) SetConfig(cfg *Config) *DummyStateManager
SetConfig can be used to store a config into the dummy state manager
type NullStateManager ¶
type NullStateManager struct { }
func (*NullStateManager) Close ¶
func (n *NullStateManager) Close()
func (*NullStateManager) GetParsedValue ¶
func (n *NullStateManager) GetParsedValue(*Config) interface{}
func (*NullStateManager) SetParsedValue ¶
func (n *NullStateManager) SetParsedValue(*Config, interface{})
type State ¶
type State struct { Configs []*Config // contains filtered or unexported fields }
State is what is kept in memory by the statemanager It is an exposed struct to support the dummy State manage\r
type StateManager ¶
type StateManager interface { GetKey(string) (*Config, error) GetParsedValue(*Config) interface{} SetParsedValue(*Config, interface{}) Close() }
Statemanager is responsible for managing configmanager State. Configmanager client interacts with Statemanager to get raw configs
func NewStateManager ¶
func NewStateManager(dirPath string, scope string, updateChan chan struct{}, fr obs.FlightRecorder) (StateManager, error)
NewStateManager returns the State manager which is used by the configmanager client. State manager watches the file for config changes and loads the State in memory.