Documentation ¶
Index ¶
- Variables
- type CacheHealthFn
- type Config
- type EnvHealthFn
- type ProxyService
- type QueryStore
- type SDKClients
- type Service
- func (s Service) Authenticate(ctx context.Context, req domain.AuthRequest) (domain.AuthResponse, error)
- func (s Service) Evaluations(ctx context.Context, req domain.EvaluationsRequest) ([]clientgen.Evaluation, error)
- func (s Service) EvaluationsByFeature(ctx context.Context, req domain.EvaluationsByFeatureRequest) (clientgen.Evaluation, error)
- func (s Service) FeatureConfig(ctx context.Context, req domain.FeatureConfigRequest) ([]domain.FeatureConfig, error)
- func (s Service) FeatureConfigByIdentifier(ctx context.Context, req domain.FeatureConfigByIdentifierRequest) (domain.FeatureConfig, error)
- func (s Service) GenerateQueryStore(ctx context.Context, environmentID string) QueryStore
- func (s Service) Health(ctx context.Context) (domain.HealthResponse, error)
- func (s Service) Metrics(ctx context.Context, req domain.MetricsRequest) error
- func (s Service) Stream(ctx context.Context, req domain.StreamRequest) (domain.StreamResponse, error)
- func (s Service) TargetSegments(ctx context.Context, req domain.TargetSegmentsRequest) ([]domain.Segment, error)
- func (s Service) TargetSegmentsByIdentifier(ctx context.Context, req domain.TargetSegmentsByIdentifierRequest) (domain.Segment, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotImplemented is the error returned when a method hasn't been implemented ErrNotImplemented = errors.New("endpoint not implemented") // ErrNotFound is the error returned when the service can't find the requested // resource ErrNotFound = errors.New("not found") // ErrInternal is the error that the proxy service returns when it encounters // an unexpected error ErrInternal = errors.New("internal error") ErrUnauthorised = errors.New("unauthorised") // ErrStreamDisconnected is the error that the proxy service returns when // its internal sdk has disconnected from the SaaS stream ErrStreamDisconnected = errors.New("SaaS stream disconnected") )
Functions ¶
This section is empty.
Types ¶
type CacheHealthFn ¶
CacheHealthFn is a function that checks the cache health
type Config ¶
type Config struct { Logger log.ContextualLogger FeatureRepo repository.FeatureFlagRepo TargetRepo repository.TargetRepo SegmentRepo repository.SegmentRepo AuthRepo repository.AuthRepo CacheHealthFn CacheHealthFn EnvHealthFn EnvHealthFn AuthFn authTokenFn ClientService clientService MetricService metricService Offline bool Hasher hash.Hasher StreamingEnabled bool SDKClients SDKClients }
Config is the config for a Service
type EnvHealthFn ¶
type EnvHealthFn func() []domain.EnvironmentHealth
EnvHealthFn is a function that checks the health of all connected environments
type ProxyService ¶
type ProxyService interface { // Authenticate performs authentication Authenticate(ctx context.Context, req domain.AuthRequest) (domain.AuthResponse, error) // FeatureConfig gets all FeatureConfig for an environment FeatureConfig(ctx context.Context, req domain.FeatureConfigRequest) ([]domain.FeatureConfig, error) // FeatureConfigByIdentifier gets the feature config for a feature FeatureConfigByIdentifier(ctx context.Context, req domain.FeatureConfigByIdentifierRequest) (domain.FeatureConfig, error) // TargetSegments gets all of the TargetSegments in an environment TargetSegments(ctx context.Context, req domain.TargetSegmentsRequest) ([]domain.Segment, error) // TargetSegmentsByIdentifier get a TargetSegments from an environment by its identifier TargetSegmentsByIdentifier(ctx context.Context, req domain.TargetSegmentsByIdentifierRequest) (domain.Segment, error) // Evaluations gets all of the evaluations in an environment for a target Evaluations(ctx context.Context, req domain.EvaluationsRequest) ([]clientgen.Evaluation, error) // Evaluations gets all of the evaluations in an environment for a target for a particular feature EvaluationsByFeature(ctx context.Context, req domain.EvaluationsByFeatureRequest) (clientgen.Evaluation, error) // Stream returns the name of the GripChannel that the client should subscribe to Stream(ctx context.Context, req domain.StreamRequest) (domain.StreamResponse, error) // Metrics forwards metrics to the analytics service Metrics(ctx context.Context, req domain.MetricsRequest) error // Health checks the health of the system Health(ctx context.Context) (domain.HealthResponse, error) }
ProxyService is the interface for the ProxyService
type QueryStore ¶
type QueryStore struct { F func(identifier string) (rest.FeatureConfig, error) S func(identifier string) (rest.Segment, error) L func() ([]rest.FeatureConfig, error) }
QueryStore ...
func (QueryStore) GetFlag ¶
func (q QueryStore) GetFlag(identifier string) (rest.FeatureConfig, error)
GetFlag returns a FeatureConfig from the QueryStore
func (QueryStore) GetFlags ¶
func (q QueryStore) GetFlags() ([]rest.FeatureConfig, error)
GetFlags returns FeatureConfigs from the QueryStore
func (QueryStore) GetSegment ¶
func (q QueryStore) GetSegment(identifier string) (rest.Segment, error)
GetSegment returns a Segment from the QueryStore
type SDKClients ¶
SDKClients is an interface that can be used to find out if internal sdks are connected to the SaaS FF stream
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the proxy service implementation
func (Service) Authenticate ¶
func (s Service) Authenticate(ctx context.Context, req domain.AuthRequest) (domain.AuthResponse, error)
Authenticate performs authentication
func (Service) Evaluations ¶
func (s Service) Evaluations(ctx context.Context, req domain.EvaluationsRequest) ([]clientgen.Evaluation, error)
Evaluations gets all the evaluations in an environment for a target
func (Service) EvaluationsByFeature ¶
func (s Service) EvaluationsByFeature(ctx context.Context, req domain.EvaluationsByFeatureRequest) (clientgen.Evaluation, error)
EvaluationsByFeature gets all the evaluations in an environment for a target for a particular feature
func (Service) FeatureConfig ¶
func (s Service) FeatureConfig(ctx context.Context, req domain.FeatureConfigRequest) ([]domain.FeatureConfig, error)
FeatureConfig gets all FeatureConfig for an environment
func (Service) FeatureConfigByIdentifier ¶
func (s Service) FeatureConfigByIdentifier(ctx context.Context, req domain.FeatureConfigByIdentifierRequest) (domain.FeatureConfig, error)
FeatureConfigByIdentifier gets the feature config for a feature
func (Service) GenerateQueryStore ¶
func (s Service) GenerateQueryStore(ctx context.Context, environmentID string) QueryStore
GenerateQueryStore returns a QueryStore object which can be passed to the go sdk evaluator
func (Service) Stream ¶
func (s Service) Stream(ctx context.Context, req domain.StreamRequest) (domain.StreamResponse, error)
Stream does a lookup for the environmentID for the APIKey in the StreamRequest and returns it as the GripChannel.
func (Service) TargetSegments ¶
func (s Service) TargetSegments(ctx context.Context, req domain.TargetSegmentsRequest) ([]domain.Segment, error)
TargetSegments gets all of the TargetSegments in an environment
func (Service) TargetSegmentsByIdentifier ¶
func (s Service) TargetSegmentsByIdentifier(ctx context.Context, req domain.TargetSegmentsByIdentifierRequest) (domain.Segment, error)
TargetSegmentsByIdentifier get a TargetSegments from an environment by its identifier