retriever

package
v1.45.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 13 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonInitializableRetriever added in v1.30.0

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 added in v1.21.0

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 added in v1.30.0

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 Manager added in v1.21.0

type Manager struct {
	// contains filtered or unexported fields
}

Manager is a struct that managed the retrievers.

func NewManager added in v1.21.0

func NewManager(
	config ManagerConfig, retrievers []Retriever, cacheManager cache.Manager, logger *fflog.FFLogger) *Manager

NewManager create a new Manager.

func (*Manager) ForceRefresh added in v1.45.1

func (m *Manager) ForceRefresh() bool

func (*Manager) GetCacheRefreshDate added in v1.45.1

func (m *Manager) GetCacheRefreshDate() time.Time

GetCacheRefreshDate gives the last refresh date of the cache

func (*Manager) GetFlag added in v1.45.1

func (m *Manager) GetFlag(flagKey string) (flag.Flag, error)

GetFlag returns the flag from the cache with the current state when calling this method.

func (*Manager) GetFlagsFromCache added in v1.45.1

func (m *Manager) GetFlagsFromCache() (map[string]flag.Flag, error)

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 added in v1.21.0

func (m *Manager) Init(ctx context.Context) error

Init the retrievers. This function will call the Init function of the retrievers that implements the InitializableRetriever interface.

func (*Manager) Shutdown added in v1.21.0

func (m *Manager) Shutdown(ctx context.Context) error

Shutdown the retrievers. This function will call the Shutdown function of the retrievers that implements the InitializableRetriever interface.

func (*Manager) StartPolling added in v1.45.1

func (m *Manager) StartPolling()

StartPolling is the daemon that refreshes the cache every X seconds.

func (*Manager) StopPolling added in v1.45.1

func (m *Manager) StopPolling()

StopPolling is the function to stop the background updater.

type ManagerConfig added in v1.45.1

type ManagerConfig struct {
	Ctx                             context.Context
	FileFormat                      string
	DisableNotifierOnInit           bool
	PersistentFlagConfigurationFile string
	StartWithRetrieverError         bool
	EnablePollingJitter             bool
	PollingInterval                 time.Duration
}

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 added in v1.21.0

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"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL