flagd

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 11 Imported by: 11

Documentation

Index

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 (p *Provider) EventChannel() <-chan of.Event

func (*Provider) FloatEvaluation

func (p *Provider) FloatEvaluation(
	ctx context.Context, flagKey string, defaultValue float64, evalCtx of.FlattenedContext,
) of.FloatResolutionDetail

func (*Provider) Hooks

func (p *Provider) Hooks() []of.Hook

Hooks flagd provider does not have any hooks, returns empty slice

func (*Provider) Init added in v0.1.16

func (p *Provider) Init(_ of.EvaluationContext) error

func (*Provider) IntEvaluation

func (p *Provider) IntEvaluation(
	ctx context.Context, flagKey string, defaultValue int64, evalCtx of.FlattenedContext,
) of.IntResolutionDetail

func (*Provider) Metadata

func (p *Provider) Metadata() of.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) Shutdown added in v0.1.16

func (p *Provider) Shutdown()

func (*Provider) Status added in v0.1.16

func (p *Provider) Status() of.State

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

func WithoutCache

func WithoutCache() ProviderOption

WithoutCache disables caching

type ResolverType added in v0.1.19

type ResolverType string

Directories

Path Synopsis
service
rpc

Jump to

Keyboard shortcuts

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