Documentation ¶
Index ¶
- type IFace
- type Mock
- type Nil
- type RandomGenerator
- type Snapshot
- func (s *Snapshot) Entries() map[string]*entry.Entry
- func (s *Snapshot) FeatureEnabled(key string, defaultValue uint64) bool
- func (s *Snapshot) Get(key string) string
- func (s *Snapshot) GetInteger(key string, defaultValue uint64) uint64
- func (s *Snapshot) Keys() []string
- func (s *Snapshot) SetEntry(key string, e *entry.Entry)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IFace ¶
type IFace interface { // Test if a feature is enabled using the built in random generator. This is done by generating // a random number in the range 0-99 and seeing if this number is < the value stored in the // runtime key, or the default_value if the runtime key is invalid. // NOTE: In the current implementation, this routine may return different results each time it // is called because a new random number is used each time. Callers should understand this // behavior and not assume that subsequent calls using the same snapshot will be // consistent. // @param key supplies the feature key to lookup. // @param defaultValue supplies the default value that will be used if either the feature key // does not exist or it is not an integer. // @return true if the feature is enabled. FeatureEnabled(key string, defaultValue uint64) bool // Fetch raw runtime data based on key. // @param key supplies the key to fetch. // @return const std::string& the value or empty string if the key does not exist. Get(key string) string // Fetch an integer runtime key. // @param key supplies the key to fetch. // @param defaultValue supplies the value to return if the key does not exist or it does not // contain an integer. // @return uint64 the runtime value or the default value. GetInteger(key string, defaultValue uint64) uint64 // Fetch all keys inside the snapshot. // @return []string all of the keys. Keys() []string Entries() map[string]*entry.Entry SetEntry(string, *entry.Entry) }
Snapshot provides the currently loaded set of runtime values.
type Mock ¶ added in v0.1.1
type Mock struct {
*Snapshot
}
Mock provides a Snapshot implementation for testing
func (*Mock) FeatureEnabled ¶ added in v0.1.1
FeatureEnabled overrides the internal `Snapshot`s `FeatureEnabled`
func (*Mock) SetDisabled ¶ added in v0.1.1
SetDisabled overrides the entry for `key` to be disabled
func (*Mock) SetEnabled ¶ added in v0.1.1
SetEnabled overrides the entry for `key` to be enabled
type RandomGenerator ¶
type RandomGenerator interface { // @return uint64 a new random number. Random() uint64 }
Random number generator. Implementations should be thread safe.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Implementation of Snapshot for the filesystem loader.
func (*Snapshot) FeatureEnabled ¶
Click to show internal directories.
Click to hide internal directories.