config

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Overview

Package config //

Package config //

Index

Constants

View Source
const DatafileURLTemplate = "https://cdn.optimizely.com/datafiles/%s.json"

DatafileURLTemplate is used to construct the endpoint for retrieving the datafile from the CDN

View Source
const DefaultPollingInterval = 5 * time.Minute // default to 5 minutes for polling

DefaultPollingInterval sets default interval for polling manager

View Source
const LastModified = "Last-Modified"

LastModified header key for response

View Source
const ModifiedSince = "If-Modified-Since"

ModifiedSince header key for request

Variables

This section is empty.

Functions

This section is empty.

Types

type OptionFunc

type OptionFunc func(*PollingProjectConfigManager)

OptionFunc is used to provide custom configuration to the PollingProjectConfigManager.

func WithDatafileURLTemplate

func WithDatafileURLTemplate(datafileTemplate string) OptionFunc

WithDatafileURLTemplate is an optional function, sets a passed datafile URL template

func WithInitialDatafile

func WithInitialDatafile(datafile []byte) OptionFunc

WithInitialDatafile is an optional function, sets a passed datafile

func WithPollingInterval

func WithPollingInterval(interval time.Duration) OptionFunc

WithPollingInterval is an optional function, sets a passed polling interval

func WithRequester

func WithRequester(requester utils.Requester) OptionFunc

WithRequester is an optional function, sets a passed requester

type PollingProjectConfigManager

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

PollingProjectConfigManager maintains a dynamic copy of the project config by continuously polling for the datafile from the Optimizely CDN at a given (configurable) interval.

func NewPollingProjectConfigManager

func NewPollingProjectConfigManager(sdkKey string, pollingMangerOptions ...OptionFunc) *PollingProjectConfigManager

NewPollingProjectConfigManager returns an instance of the polling config manager with the customized configuration

func (*PollingProjectConfigManager) GetConfig

GetConfig returns the project config

func (*PollingProjectConfigManager) OnProjectConfigUpdate

func (cm *PollingProjectConfigManager) OnProjectConfigUpdate(callback func(notification.ProjectConfigUpdateNotification)) (int, error)

OnProjectConfigUpdate registers a handler for ProjectConfigUpdate notifications

func (*PollingProjectConfigManager) RemoveOnProjectConfigUpdate

func (cm *PollingProjectConfigManager) RemoveOnProjectConfigUpdate(id int) error

RemoveOnProjectConfigUpdate removes handler for ProjectConfigUpdate notification with given id

func (*PollingProjectConfigManager) Start

func (cm *PollingProjectConfigManager) Start(sdkKey string, exeCtx utils.ExecutionCtx)

Start starts the polling

func (*PollingProjectConfigManager) SyncConfig

func (cm *PollingProjectConfigManager) SyncConfig(sdkKey string, datafile []byte)

SyncConfig gets current datafile and updates projectConfig

type StaticProjectConfigManager

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

StaticProjectConfigManager maintains a static copy of the project config

func NewStaticProjectConfigManager

func NewStaticProjectConfigManager(config pkg.ProjectConfig) *StaticProjectConfigManager

NewStaticProjectConfigManager creates a new instance of the manager with the given project config

func NewStaticProjectConfigManagerFromPayload

func NewStaticProjectConfigManagerFromPayload(payload []byte) (*StaticProjectConfigManager, error)

NewStaticProjectConfigManagerFromPayload returns new instance of StaticProjectConfigManager for payload

func NewStaticProjectConfigManagerFromURL

func NewStaticProjectConfigManagerFromURL(sdkKey string) (*StaticProjectConfigManager, error)

NewStaticProjectConfigManagerFromURL returns new instance of StaticProjectConfigManager for URL

func (*StaticProjectConfigManager) GetConfig

GetConfig returns the project config

func (*StaticProjectConfigManager) OnProjectConfigUpdate

func (cm *StaticProjectConfigManager) OnProjectConfigUpdate(callback func(notification.ProjectConfigUpdateNotification)) (int, error)

OnProjectConfigUpdate here satisfies interface

func (*StaticProjectConfigManager) RemoveOnProjectConfigUpdate

func (cm *StaticProjectConfigManager) RemoveOnProjectConfigUpdate(id int) error

RemoveOnProjectConfigUpdate here satisfies interface

Directories

Path Synopsis
Package datafileprojectconfig // Package datafileprojectconfig //
Package datafileprojectconfig // Package datafileprojectconfig //
entities
Package entities has entity definitions
Package entities has entity definitions
mappers
Package mappers ...
Package mappers ...

Jump to

Keyboard shortcuts

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