repository

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRepo

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

AuthRepo is a repository that stores a map of api key hashes to environmentIDs

func NewAuthRepo

func NewAuthRepo(c cache.Cache, config map[domain.AuthAPIKey]string, approvedEnvironments map[string]struct{}) (AuthRepo, error)

NewAuthRepo creates an AuthRepo from a map of api key hashes to environmentIDs

func (AuthRepo) Add

func (a AuthRepo) Add(ctx context.Context, values ...domain.AuthConfig) error

Add adds environment api key hash pairs to the cache

func (AuthRepo) Get

func (a AuthRepo) Get(ctx context.Context, key domain.AuthAPIKey) (string, bool)

Get gets the environmentID for the passed api key hash if the auth repo has been configured with approved envs only return keys that belong to those envs

type FeatureFlagOption

type FeatureFlagOption func(f *FeatureFlagRepo)

FeatureFlagOption defines functional option for a FeatureFlagRepo

func WithFeatureConfig

func WithFeatureConfig(config map[domain.FeatureFlagKey]interface{}) FeatureFlagOption

WithFeatureConfig populates a FeatureFlagRepo with the given config

type FeatureFlagRepo

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

FeatureFlagRepo is a repository that stores FeatureFlags

func NewFeatureFlagRepo

func NewFeatureFlagRepo(c cache.Cache, opts ...FeatureFlagOption) (FeatureFlagRepo, error)

NewFeatureFlagRepo creates a FeatureFlagRepo. It can optionally preload the repo with data from the passed config

func (FeatureFlagRepo) Get

func (f FeatureFlagRepo) Get(ctx context.Context, envID string) ([]domain.FeatureFlag, error)

Get gets all of the FeatureFlag for a given key

func (FeatureFlagRepo) GetByIdentifier

func (f FeatureFlagRepo) GetByIdentifier(ctx context.Context, envID string, identifier string) (domain.FeatureFlag, error)

GetByIdentifier gets a FeatureFlag for a given key and identifier

type SegmentOption

type SegmentOption func(s *SegmentRepo)

SegmentOption defines functional option for a SegmentRepo

func WithSegmentConfig

func WithSegmentConfig(config map[domain.SegmentKey]interface{}) SegmentOption

WithSegmentConfig populates a SegmentRepo with the given config

type SegmentRepo

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

SegmentRepo is a repository that stores Segments

func NewSegmentRepo

func NewSegmentRepo(c cache.Cache, opts ...SegmentOption) (SegmentRepo, error)

NewSegmentRepo creates a SegmentRepo. It can optionally preload the repo with data from the passed config

func (SegmentRepo) Get

func (t SegmentRepo) Get(ctx context.Context, envID string) ([]domain.Segment, error)

Get gets all of the Segments for a given key

func (SegmentRepo) GetByIdentifier

func (t SegmentRepo) GetByIdentifier(ctx context.Context, envID string, identifier string) (domain.Segment, error)

GetByIdentifier gets a Segment for a given key and identifer

type TargetOption

type TargetOption func(t *TargetRepo)

TargetOption defines functional option for a TargetRepo

func WithTargetConfig

func WithTargetConfig(config map[domain.TargetKey]interface{}) TargetOption

WithTargetConfig populates a TargetRepo with the given config

type TargetRepo

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

TargetRepo is a repository that stores Targets

func NewTargetRepo

func NewTargetRepo(c cache.Cache, opts ...TargetOption) (TargetRepo, error)

NewTargetRepo creates a TargetRepo. It can optionally preload the repo with data from the passed config

func (TargetRepo) Add

func (t TargetRepo) Add(ctx context.Context, envID string, targets ...domain.Target) error

func (TargetRepo) DeltaAdd

func (t TargetRepo) DeltaAdd(ctx context.Context, envID string, targets ...domain.Target) error

DeltaAdd adds new Targets and updates existing Targets for the given key if they exist in the cache. It will remove any existing Targets from the cache that are not in the list of new Targets. If you pass it an empty list of Targets it will return an error to avoid wiping all of the Targets from the cache. If we want to remove all of the Targets for a given key then we should add an explicit Remove method that calls cache.Remove.

func (TargetRepo) Get

func (t TargetRepo) Get(ctx context.Context, envID string) ([]domain.Target, error)

Get gets all of the Targets for a given key

func (TargetRepo) GetByIdentifier

func (t TargetRepo) GetByIdentifier(ctx context.Context, envID string, identifier string) (domain.Target, error)

GetByIdentifier gets a Target for a given key and identifer

Jump to

Keyboard shortcuts

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