pkg

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider deprecated

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

Deprecated: Please use flagd with WithInProcessResolver option instead of this dedicated provider

func NewProvider

func NewProvider(ctx context.Context, opts ...ProviderOption) *Provider

Deprecated : Please use flagd with WithInProcessResolver option instead of this dedicated provider

func (*Provider) BooleanEvaluation

func (p *Provider) BooleanEvaluation(
	ctx context.Context, flagKey string, defaultValue bool, evalCtx of.FlattenedContext,
) of.BoolResolutionDetail

func (*Provider) EventChannel

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 in-processflagd provider does not have any hooks, returns empty slice

func (*Provider) Init

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

Init implements the Init method required for the OF API StateHandler interface

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 completed the initial flag sync

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

func (p *Provider) Shutdown()

Shutdown implements the shutdown logic for this provider

func (*Provider) Status

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

Status returns the current provider status

func (*Provider) StringEvaluation

func (p *Provider) StringEvaluation(
	ctx context.Context, flagKey string, defaultValue string, evalCtx of.FlattenedContext,
) of.StringResolutionDetail

type ProviderConfiguration

type ProviderConfiguration struct {
	CertificatePath string
	TLSEnabled      bool
	SourceConfig    runtime.SourceConfig
}

type ProviderOption

type ProviderOption func(*Provider)

func FromEnv

func FromEnv() ProviderOption

FromEnv sets the provider configuration from environment variables (if set) as defined https://github.com/open-feature/flagd/blob/main/docs/other_resources/creating_providers.md?plain=1#L117

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 WithLogger

func WithLogger(l *logger.Logger) ProviderOption

WithLogger sets the logger used by the provider.

func WithSelector

func WithSelector(selector string) ProviderOption

WithSelector sets the selector for the sync source

func WithSourceType

func WithSourceType(providerType ProviderType) ProviderOption

func WithSourceURI

func WithSourceURI(uri string) ProviderOption

WithSourceURI sets the URI of the sync source

func WithSyncStreamConnectionBackoff

func WithSyncStreamConnectionBackoff(duration time.Duration) ProviderOption

WithSyncStreamConnectionBackoff sets the backoff duration between reattempts of connecting to the sync source.

func WithSyncStreamConnectionMaxAttempts

func WithSyncStreamConnectionMaxAttempts(i int) ProviderOption

WithSyncStreamConnectionMaxAttempts sets the maximum number of attempts to connect to flagd's event stream. On successful connection the attempts are reset.

func WithTLS

func WithTLS(certPath string) ProviderOption

WithTLS enables TLS. If certPath is not given, system certs are used.

type ProviderType

type ProviderType string
const (
	SourceTypeGrpc       ProviderType = "grpc"
	SourceTypeKubernetes ProviderType = "kubernetes"
)

Jump to

Keyboard shortcuts

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