Documentation
¶
Index ¶
- Variables
- type Cache
- type Callback
- 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 Repository
- func (r Repository) Close()
- func (r Repository) DeleteFlag(identifier string)
- func (r Repository) DeleteSegment(identifier string)
- func (r Repository) GetFlag(identifier string) (rest.FeatureConfig, error)
- func (r Repository) GetSegment(identifier string) (rest.Segment, error)
- func (r Repository) SetFlag(featureConfig rest.FeatureConfig)
- func (r Repository) SetSegment(segment rest.Segment)
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)
OnSegmentStored(identifier string)
OnSegmentDeleted(identifier string)
}
Callback provides events when repository data being modified
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 NewWithStorage ¶
func NewWithStorage(cache Cache, storage storage.Storage) Repository
NewWithStorage works with offline storage implementation
func NewWithStorageAndCallback ¶
func NewWithStorageAndCallback(cache Cache, storage storage.Storage, callback Callback) Repository
NewWithStorageAndCallback factory function with cache, offline storage and listener on events
func (Repository) DeleteFlag ¶
func (r Repository) DeleteFlag(identifier string)
DeleteFlag removes a flag from the repository
func (Repository) DeleteSegment ¶
func (r Repository) DeleteSegment(identifier string)
DeleteSegment removes a segment from the repository
func (Repository) GetFlag ¶
func (r Repository) GetFlag(identifier string) (rest.FeatureConfig, error)
GetFlag returns flag from cache or offline storage
func (Repository) GetSegment ¶
func (r Repository) GetSegment(identifier string) (rest.Segment, error)
GetSegment returns flag from cache or offline storage
func (Repository) SetFlag ¶
func (r Repository) SetFlag(featureConfig rest.FeatureConfig)
SetFlag places a flag in the repository with the new value
func (Repository) SetSegment ¶
func (r Repository) SetSegment(segment rest.Segment)
SetSegment places a segment in the repository with the new value