Documentation ¶
Index ¶
- Variables
- type Cache
- type Callback
- type FileStorage
- type LRUCache
- func (lru LRUCache) Contains(key interface{}) bool
- func (lru LRUCache) Get(key interface{}) (value interface{}, ok bool)
- func (lru LRUCache) Keys() []interface{}
- func (lru LRUCache) Len() int
- func (lru LRUCache) Remove(key interface{}) (present bool)
- func (lru LRUCache) Set(key interface{}, value interface{}) (evicted bool)
- type Option
- type Repository
- func (r Repository) Close()
- func (r Repository) DeleteConfiguration(identifier string)
- func (r Repository) DeleteVariable(identifier string)
- func (r Repository) GetConfiguration(identifier string) (evaluation.Configuration, error)
- func (r Repository) GetVariable(identifier string) (evaluation.Variable, error)
- func (r Repository) SetConfiguration(config *evaluation.Configuration)
- func (r Repository) SetVariable(variable *evaluation.Variable)
- type Storage
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFeatureConfigNotFound ... ErrFeatureConfigNotFound = errors.New("feature config not found") // ErrSegmentNotFound ... ErrSegmentNotFound = errors.New("target group not found") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Set(key interface{}, value interface{}) (evicted bool) Contains(key interface{}) bool Get(key interface{}) (value interface{}, ok bool) Keys() []interface{} Len() int Remove(key interface{}) (present bool) }
Cache wrapper to integrate any 3rd party implementation
type Callback ¶
type Callback interface { OnFlagStored(identifier string) OnFlagDeleted(identifier string) OnVariableStored(identifier string) OnVariableDeleted(identifier string) }
Callback provides events when repository data being modified
type FileStorage ¶
type FileStorage struct {
// contains filtered or unexported fields
}
func NewFileStorage ¶
func NewFileStorage(path string) (FileStorage, error)
func (*FileStorage) Get ¶
func (f *FileStorage) Get(key string, output interface{}) error
func (*FileStorage) List ¶
func (f *FileStorage) List() []interface{}
func (*FileStorage) Remove ¶
func (f *FileStorage) Remove(s string) error
func (*FileStorage) Set ¶
func (f *FileStorage) Set(key string, value interface{}) error
type LRUCache ¶
LRUCache is thread-safe LAST READ USED Cache
func NewLruCache ¶
NewLruCache creates a new LRU instance
func (LRUCache) Keys ¶
func (lru LRUCache) Keys() []interface{}
Keys returns a slice of the keys in the cache, from oldest to newest.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository holds cache and optionally offline data
func New ¶
func New(cache Cache, options ...Option) Repository
New repository with only cache capability
func (Repository) DeleteConfiguration ¶
func (r Repository) DeleteConfiguration(identifier string)
DeleteConfiguration removes a flag from the repository
func (Repository) DeleteVariable ¶
func (r Repository) DeleteVariable(identifier string)
DeleteVariable removes a segment from the repository
func (Repository) GetConfiguration ¶
func (r Repository) GetConfiguration(identifier string) (evaluation.Configuration, error)
GetConfiguration returns flag from cache or offline storage
func (Repository) GetVariable ¶
func (r Repository) GetVariable(identifier string) (evaluation.Variable, error)
GetVariable return variable from repository
func (Repository) SetConfiguration ¶
func (r Repository) SetConfiguration(config *evaluation.Configuration)
SetConfiguration places a flag in the repository with the new value
func (Repository) SetVariable ¶
func (r Repository) SetVariable(variable *evaluation.Variable)
SetVariable places a variable in the repository with the new value
type Storage ¶
type Storage interface { // Get returns the data for the specified feature toggle. Get(string, interface{}) error Set(string, interface{}) error Remove(string) error // List returns a list of all feature toggles. List() []interface{} }
Storage is an interface that can be implemented in order to have control over how the repository of feature toggles is persisted.