bucketing

package
v2.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIKey

func APIKey(apiKey string) func(r *APIClient)

APIKey sets http client api key

func APIOptions

func APIOptions(apiOptions ...func(*APIClient)) func(r *Engine)

APIOptions sets the func option for the engine client API

func APIUrl

func APIUrl(url string) func(r *APIClient)

APIUrl sets http client base URL

func PollingInterval

func PollingInterval(interval time.Duration) func(r *Engine)

PollingInterval sets the polling interval for the bucketing engine

func Retries

func Retries(retries int) func(r *APIClient)

Retries sets max number of retries for failed calls

func Timeout

func Timeout(timeout time.Duration) func(r *APIClient)

Timeout sets http client timeout

Types

type APIClient

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

APIClient represents the API client informations

func NewAPIClient

func NewAPIClient(envID string, params ...func(*APIClient)) *APIClient

NewAPIClient creates a bucketing API Client to poll bucketing infos

func (*APIClient) GetConfiguration

func (r *APIClient) GetConfiguration() (*bucketingProto.Bucketing_BucketingResponse, error)

GetConfiguration gets an environment configuration from bucketing file

type APIClientMock

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

APIClientMock represents the API client mock informations

func NewAPIClientMock

func NewAPIClientMock(envID string, responseMock *bucketing.Bucketing_BucketingResponse, statusCode int) *APIClientMock

NewAPIClientMock creates a fake api client that returns a specific response

func (*APIClientMock) GetConfiguration

func (r *APIClientMock) GetConfiguration() (*bucketing.Bucketing_BucketingResponse, error)

GetConfiguration mocks a configuration

type ConfigAPIInterface

type ConfigAPIInterface interface {
	GetConfiguration() (*bucketing.Bucketing_BucketingResponse, error)
}

ConfigAPIInterface manage the bucketing configuration

type Engine

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

Engine represents a bucketing engine

func GetBucketingEngineMock

func GetBucketingEngineMock(testEnvID string, cache cache.Manager) *Engine

GetBucketingEngineMock returns a bucketing engine with mock config

func NewEngine

func NewEngine(envID string, cacheManager cache.Manager, params ...func(*Engine)) (*Engine, error)

NewEngine creates a new engine for bucketing

func (*Engine) GetModifications

func (b *Engine) GetModifications(visitorID string, anonymousID *string, context model.Context) (*model.APIClientResponse, error)

GetModifications gets modifications from Decision API

func (*Engine) Load

func (b *Engine) Load() error

Load loads the env configuration in cache

type EngineOptions

type EngineOptions struct {
	// PollingInterval is the number of milliseconds between each poll. If -1, then no polling will be done
	PollingInterval time.Duration
}

EngineOptions represents the options for the Bucketing decision mode

Jump to

Keyboard shortcuts

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