Documentation ¶
Index ¶
- Variables
- type Cache
- type Callback
- type FFRepository
- func (r FFRepository) Close()
- func (r FFRepository) DeleteFlag(identifier string)
- func (r FFRepository) DeleteFlags(envID string, identifier string)
- func (r FFRepository) DeleteSegment(identifier string)
- func (r FFRepository) DeleteSegments(envID string, identifier string)
- func (r FFRepository) GetFlag(identifier string) (rest.FeatureConfig, error)
- func (r FFRepository) GetFlagMap() (map[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) SetFlags(initialLoad bool, envID string, featureConfigs ...rest.FeatureConfig)
- func (r FFRepository) SetSegment(segment rest.Segment, initialLoad bool)
- func (r FFRepository) SetSegments(initialLoad bool, envID string, segments ...rest.Segment)
- 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) OnFlagsStored(envID string) OnFlagsDeleted(envID string, identifier string) OnFlagDeleted(identifier string) OnSegmentStored(identifier string) OnSegmentsStored(envID string) OnSegmentDeleted(identifier string) OnSegmentsDeleted(envID string, 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) DeleteFlags ¶ added in v0.1.11
func (r FFRepository) DeleteFlags(envID string, identifier string)
DeleteFlags removes a flag from the flags key.
We can't just delete the key here the way we can for a single flag because then we'd be removing flags that haven't been deleted. So we have to first fetch value, then remove the specific flag that has been deleted and update the key in the cache/storage
func (FFRepository) DeleteSegment ¶ added in v0.0.25
func (r FFRepository) DeleteSegment(identifier string)
DeleteSegment removes a segment from the repository
func (FFRepository) DeleteSegments ¶ added in v0.1.11
func (r FFRepository) DeleteSegments(envID string, identifier string)
DeleteSegments removes a Segment from the segments key.
We can't just delete the key here the way we can for a single flag because then we'd be removing segments that haven't been deleted. So we have to first fetch value, then remove the specific segment that has been deleted and update the key in the cache/storage
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) GetFlagMap ¶ added in v0.1.11
func (r FFRepository) GetFlagMap() (map[string]*rest.FeatureConfig, error)
GetFlagMap returns all flags as a mao /* Not Implemented *.
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) SetFlags ¶ added in v0.1.9
func (r FFRepository) SetFlags(initialLoad bool, envID string, featureConfigs ...rest.FeatureConfig)
SetFlags places all the flags in the repository
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
func (FFRepository) SetSegments ¶ added in v0.1.9
func (r FFRepository) SetSegments(initialLoad bool, envID string, segments ...rest.Segment)
SetSegments places all the segments in the repository
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) GetFlagMap() (map[string]*rest.FeatureConfig, error) SetFlag(featureConfig rest.FeatureConfig, initialLoad bool) SetFlags(initialLoad bool, envID string, featureConfig ...rest.FeatureConfig) SetSegment(segment rest.Segment, initialLoad bool) SetSegments(initialLoad bool, envID string, segment ...rest.Segment) DeleteFlag(identifier string) DeleteFlags(envID string, identifier string) DeleteSegment(identifier string) DeleteSegments(envID string, 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