datasource

package
v5.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package datasource is an internal package containing implementation types for the SDK's data source implementations (streaming, polling, etc.) and related functionality. These types are not visible from outside of the SDK.

This does not include the file data source, which is in the ldfiledata package.

Index

Constants

View Source
const (
	LatestFlagsPath    = "/sdk/latest-flags"
	LatestSegmentsPath = "/sdk/latest-segments"
	LatestAllPath      = "/sdk/latest-all"
)

SDK endpoints

Variables

This section is empty.

Functions

func NewDataSourceStatusProviderImpl

func NewDataSourceStatusProviderImpl(
	broadcaster *internal.DataSourceStatusBroadcaster,
	dataSourceUpdates *DataSourceUpdatesImpl,
) interfaces.DataSourceStatusProvider

NewDataSourceStatusProviderImpl creates the internal implementation of DataSourceStatusProvider.

func NewNullDataSource

func NewNullDataSource() interfaces.DataSource

NewNullDataSource returns a stub implementation of DataSource.

Types

type DataSourceUpdatesImpl

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

DataSourceUpdatesImpl is the internal implementation of DataSourceUpdates. It is exported because the actual implementation type, rather than the interface, is required as a dependency of other SDK components.

func NewDataSourceUpdatesImpl

func NewDataSourceUpdatesImpl(
	store intf.DataStore,
	dataStoreStatusProvider intf.DataStoreStatusProvider,
	dataSourceStatusBroadcaster *internal.DataSourceStatusBroadcaster,
	flagChangeEventBroadcaster *internal.FlagChangeEventBroadcaster,
	logDataSourceOutageAsErrorAfter time.Duration,
	loggers ldlog.Loggers,
) *DataSourceUpdatesImpl

NewDataSourceUpdatesImpl creates the internal implementation of DataSourceUpdates.

func (*DataSourceUpdatesImpl) GetDataStoreStatusProvider

func (d *DataSourceUpdatesImpl) GetDataStoreStatusProvider() intf.DataStoreStatusProvider

func (*DataSourceUpdatesImpl) GetLastStatus

func (d *DataSourceUpdatesImpl) GetLastStatus() intf.DataSourceStatus

GetLastStatus is used internally by SDK components.

func (*DataSourceUpdatesImpl) Init

func (d *DataSourceUpdatesImpl) Init(allData []st.Collection) bool

func (*DataSourceUpdatesImpl) UpdateStatus

func (d *DataSourceUpdatesImpl) UpdateStatus(
	newState intf.DataSourceState,
	newError intf.DataSourceErrorInfo,
)

func (*DataSourceUpdatesImpl) Upsert

func (d *DataSourceUpdatesImpl) Upsert(
	kind st.DataKind,
	key string,
	item st.ItemDescriptor,
) bool

type PollingProcessor

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

PollingProcessor is the internal implementation of the polling data source.

This type is exported from internal so that the PollingDataSourceBuilder tests can verify its configuration. All other code outside of this package should interact with it only via the DataSource interface.

func NewPollingProcessor

func NewPollingProcessor(
	context interfaces.ClientContext,
	dataSourceUpdates interfaces.DataSourceUpdates,
	baseURI string,
	pollInterval time.Duration,
) *PollingProcessor

NewPollingProcessor creates the internal implementation of the polling data source.

func (*PollingProcessor) Close

func (pp *PollingProcessor) Close() error

func (*PollingProcessor) GetBaseURI

func (pp *PollingProcessor) GetBaseURI() string

GetBaseURI returns the configured polling base URI, for testing.

func (*PollingProcessor) GetPollInterval

func (pp *PollingProcessor) GetPollInterval() time.Duration

GetPollInterval returns the configured polling interval, for testing.

func (*PollingProcessor) IsInitialized

func (pp *PollingProcessor) IsInitialized() bool

func (*PollingProcessor) Start

func (pp *PollingProcessor) Start(closeWhenReady chan<- struct{})

type StreamProcessor

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

StreamProcessor is the internal implementation of the streaming data source.

This type is exported from internal so that the StreamingDataSourceBuilder tests can verify its configuration. All other code outside of this package should interact with it only via the DataSource interface.

func NewStreamProcessor

func NewStreamProcessor(
	context interfaces.ClientContext,
	dataSourceUpdates interfaces.DataSourceUpdates,
	streamURI string,
	initialReconnectDelay time.Duration,
) *StreamProcessor

NewStreamProcessor creates the internal implementation of the streaming data source.

func (*StreamProcessor) Close

func (sp *StreamProcessor) Close() error

func (*StreamProcessor) GetBaseURI

func (sp *StreamProcessor) GetBaseURI() string

GetBaseURI returns the configured streaming base URI, for testing.

func (*StreamProcessor) GetInitialReconnectDelay

func (sp *StreamProcessor) GetInitialReconnectDelay() time.Duration

GetInitialReconnectDelay returns the configured reconnect delay, for testing.

func (*StreamProcessor) IsInitialized

func (sp *StreamProcessor) IsInitialized() bool

func (*StreamProcessor) Start

func (sp *StreamProcessor) Start(closeWhenReady chan<- struct{})

Jump to

Keyboard shortcuts

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