Documentation
¶
Index ¶
- type Cache
- type Provider
- func (p *Provider) BooleanEvaluation(ctx context.Context, flagKey string, defaultValue bool, ...) of.BoolResolutionDetail
- func (p *Provider) Configuration() *ProviderConfiguration
- func (p *Provider) FloatEvaluation(ctx context.Context, flagKey string, defaultValue float64, ...) of.FloatResolutionDetail
- func (p *Provider) Hooks() []of.Hook
- func (p *Provider) IntEvaluation(ctx context.Context, flagKey string, defaultValue int64, ...) of.IntResolutionDetail
- func (p *Provider) IsReady() <-chan struct{}
- func (p *Provider) Metadata() of.Metadata
- func (p *Provider) ObjectEvaluation(ctx context.Context, flagKey string, defaultValue interface{}, ...) of.InterfaceResolutionDetail
- func (p *Provider) StringEvaluation(ctx context.Context, flagKey string, defaultValue string, ...) of.StringResolutionDetail
- type ProviderConfiguration
- type ProviderOption
- func FromEnv() ProviderOption
- func WithBasicInMemoryCache() ProviderOption
- func WithCertificatePath(path string) ProviderOption
- func WithContext(ctx context.Context) ProviderOption
- func WithEventStreamConnectionMaxAttempts(i int) ProviderOption
- func WithHost(host string) ProviderOption
- func WithLRUCache(size int) ProviderOption
- func WithLogger(l logr.Logger) ProviderOption
- func WithPort(port uint16) ProviderOption
- func WithSocketPath(socketPath string) ProviderOption
- func WithoutCache() ProviderOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] interface { Add(K, V) (evicted bool) Purge() Get(K) (value V, ok bool) Remove(K) (present bool) }
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
func NewProvider(opts ...ProviderOption) *Provider
func (*Provider) BooleanEvaluation ¶
func (p *Provider) BooleanEvaluation( ctx context.Context, flagKey string, defaultValue bool, evalCtx of.FlattenedContext, ) of.BoolResolutionDetail
func (*Provider) Configuration ¶
func (p *Provider) Configuration() *ProviderConfiguration
Configuration returns the current configuration of the provider
func (*Provider) FloatEvaluation ¶
func (p *Provider) FloatEvaluation( ctx context.Context, flagKey string, defaultValue float64, evalCtx of.FlattenedContext, ) of.FloatResolutionDetail
func (*Provider) IntEvaluation ¶
func (p *Provider) IntEvaluation( ctx context.Context, flagKey string, defaultValue int64, evalCtx of.FlattenedContext, ) of.IntResolutionDetail
func (*Provider) IsReady ¶
func (p *Provider) IsReady() <-chan struct{}
IsReady returns a non-blocking channel if the provider has received the provider_ready event from flagd
func (*Provider) Metadata ¶
Metadata returns value of Metadata (name of current service, exposed to openfeature sdk)
func (*Provider) ObjectEvaluation ¶
func (p *Provider) ObjectEvaluation( ctx context.Context, flagKey string, defaultValue interface{}, evalCtx of.FlattenedContext, ) of.InterfaceResolutionDetail
func (*Provider) StringEvaluation ¶
func (p *Provider) StringEvaluation( ctx context.Context, flagKey string, defaultValue string, evalCtx of.FlattenedContext, ) of.StringResolutionDetail
type ProviderConfiguration ¶
type ProviderOption ¶
type ProviderOption func(*Provider)
func FromEnv ¶
func FromEnv() ProviderOption
FromEnv sets the provider configuration from environment variables: FLAGD_HOST, FLAGD_PORT, FLAGD_SERVICE_PROVIDER, FLAGD_SERVER_CERT_PATH & FLAGD_CACHING_DISABLED
func WithBasicInMemoryCache ¶
func WithBasicInMemoryCache() ProviderOption
WithBasicInMemoryCache applies a basic in memory cache store (with no memory limits)
func WithCertificatePath ¶
func WithCertificatePath(path string) ProviderOption
WithCertificatePath specifies the location of the certificate to be used in the gRPC dial credentials. If certificate loading fails insecure credentials will be used instead
func WithContext ¶
func WithContext(ctx context.Context) ProviderOption
WithContext supplies the given context to the event stream. Not to be confused with the context used in individual flag evaluation requests.
func WithEventStreamConnectionMaxAttempts ¶
func WithEventStreamConnectionMaxAttempts(i int) ProviderOption
WithEventStreamConnectionMaxAttempts sets the maximum number of attempts to connect to flagd's event stream. On successful connection the attempts are reset.
func WithHost ¶
func WithHost(host string) ProviderOption
WithHost specifies the host name of the flagd server. Defaults to localhost
func WithLRUCache ¶
func WithLRUCache(size int) ProviderOption
WithLRUCache applies least recently used caching (github.com/hashicorp/golang-lru). The provided size is the limit of the number of cached values. Once the limit is reached each new entry replaces the least recently used entry.
func WithLogger ¶ added in v0.1.3
func WithLogger(l logr.Logger) ProviderOption
WithLogger sets the logger used by the provider.
func WithPort ¶
func WithPort(port uint16) ProviderOption
WithPort specifies the port of the flagd server. Defaults to 8013
func WithSocketPath ¶
func WithSocketPath(socketPath string) ProviderOption
WithSocketPath overrides the default hostname and port, a unix socket connection is made to flagd instead