Documentation ¶
Index ¶
- type IService
- type Provider
- func (p *Provider) BooleanEvaluation(ctx context.Context, flagKey string, defaultValue bool, ...) of.BoolResolutionDetail
- func (p *Provider) EventChannel() <-chan of.Event
- func (p *Provider) FloatEvaluation(ctx context.Context, flagKey string, defaultValue float64, ...) of.FloatResolutionDetail
- func (p *Provider) Hooks() []of.Hook
- func (p *Provider) Init(_ of.EvaluationContext) error
- func (p *Provider) IntEvaluation(ctx context.Context, flagKey string, defaultValue int64, ...) of.IntResolutionDetail
- func (p *Provider) Metadata() of.Metadata
- func (p *Provider) ObjectEvaluation(ctx context.Context, flagKey string, defaultValue interface{}, ...) of.InterfaceResolutionDetail
- func (p *Provider) Shutdown()
- func (p *Provider) Status() of.State
- func (p *Provider) StringEvaluation(ctx context.Context, flagKey string, defaultValue string, ...) of.StringResolutionDetail
- type ProviderOption
- func FromEnv() ProviderOption
- func WithBasicInMemoryCache() ProviderOption
- func WithCertificatePath(path string) ProviderOption
- func WithEventStreamConnectionMaxAttempts(i int) ProviderOption
- func WithHost(host string) ProviderOption
- func WithInProcessResolver() ProviderOption
- func WithLRUCache(size int) ProviderOption
- func WithLogger(l logr.Logger) ProviderOption
- func WithOfflineFilePath(path string) ProviderOption
- func WithOtelInterceptor(intercept bool) ProviderOption
- func WithPort(port uint16) ProviderOption
- func WithRPCResolver() ProviderOption
- func WithSelector(selector string) ProviderOption
- func WithSocketPath(socketPath string) ProviderOption
- func WithTLS(certPath string) ProviderOption
- func WithTargetUri(targetUri string) ProviderOption
- func WithoutCache() ProviderOption
- type ResolverType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IService ¶ added in v0.1.16
type IService interface { Init() error Shutdown() ResolveBoolean(ctx context.Context, key string, defaultValue bool, evalCtx map[string]interface{}) of.BoolResolutionDetail ResolveString(ctx context.Context, key string, defaultValue string, evalCtx map[string]interface{}) of.StringResolutionDetail ResolveFloat(ctx context.Context, key string, defaultValue float64, evalCtx map[string]interface{}) of.FloatResolutionDetail ResolveInt(ctx context.Context, key string, defaultValue int64, evalCtx map[string]interface{}) of.IntResolutionDetail ResolveObject(ctx context.Context, key string, defaultValue interface{}, evalCtx map[string]interface{}) of.InterfaceResolutionDetail EventChannel() <-chan of.Event }
IService abstract the service implementation for flagd provider
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) EventChannel ¶ added in v0.1.16
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) 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 ProviderOption ¶
type ProviderOption func(*Provider)
func FromEnv ¶
func FromEnv() ProviderOption
FromEnv sets the provider configuration from environment variables (if set)
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 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 WithInProcessResolver ¶ added in v0.1.19
func WithInProcessResolver() ProviderOption
WithInProcessResolver sets flag resolver to InProcess
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 WithOfflineFilePath ¶ added in v0.1.21
func WithOfflineFilePath(path string) ProviderOption
WithOfflineFilePath file path to obtain flags to run provider in offline mode with in-process evaluations. This is only useful with inProcess resolver type
func WithOtelInterceptor ¶ added in v0.1.11
func WithOtelInterceptor(intercept bool) ProviderOption
WithOtelInterceptor enable/disable otel interceptor for flagd communication
func WithPort ¶
func WithPort(port uint16) ProviderOption
WithPort specifies the port of the flagd server. Defaults to 8013
func WithRPCResolver ¶ added in v0.1.19
func WithRPCResolver() ProviderOption
WithRPCResolver sets flag resolver to RPC. RPC is the default resolving mechanism
func WithSelector ¶ added in v0.1.19
func WithSelector(selector string) ProviderOption
WithSelector sets the selector to be used for InProcess flag sync calls
func WithSocketPath ¶
func WithSocketPath(socketPath string) ProviderOption
WithSocketPath overrides the default hostname and expectPort, a unix socket connection is made to flagd instead
func WithTLS ¶ added in v0.1.7
func WithTLS(certPath string) ProviderOption
WithTLS enables TLS. If certPath is not given, system certs are used.
func WithTargetUri ¶ added in v0.2.3
func WithTargetUri(targetUri string) ProviderOption
WithTargetUri specifies the custom gRPC target URI
type ResolverType ¶ added in v0.1.19
type ResolverType string