Documentation
¶
Index ¶
- Variables
- type Cache
- type Callback
- type FFRepository
- func (r FFRepository) Close()
- func (r FFRepository) DeleteFlag(identifier string)
- func (r FFRepository) DeleteSegment(identifier string)
- func (r FFRepository) GetFlag(identifier string) (rest.FeatureConfig, error)
- func (r FFRepository) GetFlags() ([]rest.FeatureConfig, error)
- func (r FFRepository) GetSegment(identifier string) (rest.Segment, error)
- func (r FFRepository) SetFlag(featureConfig rest.FeatureConfig, initialLoad bool)
- func (r FFRepository) SetSegment(segment rest.Segment, initialLoad bool)
- 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
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 FFRepository ¶ added in v0.0.25
type FFRepository struct {
// contains filtered or unexported fields
}
FFRepository holds cache and optionally offline data
func (FFRepository) DeleteFlag ¶ added in v0.0.25
func (r FFRepository) DeleteFlag(identifier string)
DeleteFlag removes a flag from the repository
func (FFRepository) DeleteSegment ¶ added in v0.0.25
func (r FFRepository) DeleteSegment(identifier string)
DeleteSegment removes a segment from the repository
func (FFRepository) GetFlag ¶ added in v0.0.25
func (r FFRepository) GetFlag(identifier string) (rest.FeatureConfig, error)
GetFlag returns flag from cache or offline storage
func (FFRepository) GetFlags ¶ added in v0.1.5
func (r FFRepository) GetFlags() ([]rest.FeatureConfig, error)
GetFlags returns all the flags /* Not implemented */
func (FFRepository) GetSegment ¶ added in v0.0.25
func (r FFRepository) GetSegment(identifier string) (rest.Segment, error)
GetSegment returns flag from cache or offline storage
func (FFRepository) SetFlag ¶ added in v0.0.25
func (r FFRepository) SetFlag(featureConfig rest.FeatureConfig, initialLoad bool)
SetFlag places a flag in the repository with the new value
func (FFRepository) SetSegment ¶ added in v0.0.25
func (r FFRepository) SetSegment(segment rest.Segment, initialLoad bool)
SetSegment places a segment in the repository with the new value
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 interface { GetFlag(identifier string) (rest.FeatureConfig, error) GetSegment(identifier string) (rest.Segment, error) GetFlags() ([]rest.FeatureConfig, error) SetFlag(featureConfig rest.FeatureConfig, initialLoad bool) SetSegment(segment rest.Segment, initialLoad bool) DeleteFlag(identifier string) DeleteSegment(identifier string) Close() }
Repository interface for data providers
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