Documentation
¶
Index ¶
- type CommonInitializableRetriever
- type InitializableRetriever
- type InitializableRetrieverLegacy
- type InitializableRetrieverWithFlagset
- type Manager
- func (m *Manager) ForceRefresh(ctx context.Context) bool
- func (m *Manager) GetCacheRefreshDate() time.Time
- func (m *Manager) GetFlag(flagKey string) (flag.Flag, error)
- func (m *Manager) GetFlagsFromCache(_ context.Context) (map[string]flag.Flag, error)
- func (m *Manager) Init(ctx context.Context) error
- func (m *Manager) Shutdown(ctx context.Context) error
- func (m *Manager) StartPolling(ctx context.Context)
- func (m *Manager) StopPolling()
- type ManagerConfig
- type Retriever
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommonInitializableRetriever ¶
type CommonInitializableRetriever interface {
Retriever
Shutdown(ctx context.Context) error
Status() Status
}
CommonInitializableRetriever is the common interface for all versions of retrievers that can be initialized and shutdown.
type InitializableRetriever ¶
type InitializableRetriever interface {
CommonInitializableRetriever
Init(ctx context.Context, logger *fflog.FFLogger) error
}
InitializableRetriever is an extended version of the retriever that can be initialized and shutdown.
type InitializableRetrieverLegacy ¶
type InitializableRetrieverLegacy interface {
CommonInitializableRetriever
Init(ctx context.Context, logger *log.Logger) error
}
InitializableRetrieverLegacy is an extended version of the retriever that can be initialized and shutdown.
type InitializableRetrieverWithFlagset ¶
type InitializableRetrieverWithFlagset interface {
CommonInitializableRetriever
Init(ctx context.Context, logger *fflog.FFLogger, flagset *string) error
}
InitializableRetrieverWithFlagset is an extended version of the retriever that can be initialized and shutdown. It is used to initialize the retriever with a specific flagset.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a struct that managed the retrievers.
func NewManager ¶
func NewManager( config ManagerConfig, retrievers []Retriever, cacheManager cache.Manager, logger *fflog.FFLogger) *Manager
NewManager create a new Manager.
func (*Manager) GetCacheRefreshDate ¶
GetCacheRefreshDate gives the last refresh date of the cache
func (*Manager) GetFlag ¶
GetFlag returns the flag from the cache with the current state when calling this method.
func (*Manager) GetFlagsFromCache ¶
GetFlagsFromCache returns all the flags present in the cache with their current state when calling this method. If cache hasn't been initialized, an error reporting this is returned.
func (*Manager) Init ¶
Init the retrievers. This function will call the Init function of the retrievers that implements the InitializableRetriever interface.
func (*Manager) Shutdown ¶
Shutdown the retrievers. This function will call the Shutdown function of the retrievers that implements the InitializableRetriever interface.
func (*Manager) StartPolling ¶
StartPolling is the daemon that refreshes the cache every X seconds.
func (*Manager) StopPolling ¶
func (m *Manager) StopPolling()
StopPolling is the function to stop the background updater.
type ManagerConfig ¶
type ManagerConfig struct {
FileFormat string
DisableNotifierOnInit bool
PersistentFlagConfigurationFile string
StartWithRetrieverError bool
EnablePollingJitter bool
PollingInterval time.Duration
Name *string
}
ManagerConfig is the configuration of the retriever manager.
type Retriever ¶
type Retriever interface {
// Retrieve function is supposed to load the file and to return a []byte of your flag configuration file.
Retrieve(ctx context.Context) ([]byte, error)
}
Retriever is the interface to create a Retriever to load you flags.
type Status ¶
type Status = string
Status is the status of the retriever. It can be used to check if the retriever is ready to be used. If not ready, we wi will not use it.
const ( // RetrieverReady is the status when the retriever is ready to be used. RetrieverReady Status = "READY" // RetrieverNotReady is the status when the retriever is not ready yet to be used. RetrieverNotReady Status = "NOT_READY" // RetrieverError is the status when the retriever is in error. RetrieverError Status = "ERROR" )