datasource

package
v7.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 25 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

This section is empty.

Variables

This section is empty.

Functions

func NewDataSourceStatusProviderImpl

func NewDataSourceStatusProviderImpl(
	broadcaster *internal.Broadcaster[interfaces.DataSourceStatus],
	dataSourceUpdates *DataSourceUpdateSinkImpl,
) interfaces.DataSourceStatusProvider

NewDataSourceStatusProviderImpl creates the internal implementation of DataSourceStatusProvider.

func NewNullDataSource

func NewNullDataSource() subsystems.DataSource

NewNullDataSource returns a stub implementation of DataSource.

Types

type DataSourceUpdateSinkImpl

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

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

func NewDataSourceUpdateSinkImpl

func NewDataSourceUpdateSinkImpl(
	store subsystems.DataStore,
	dataStoreStatusProvider intf.DataStoreStatusProvider,
	dataSourceStatusBroadcaster *internal.Broadcaster[intf.DataSourceStatus],
	flagChangeEventBroadcaster *internal.Broadcaster[intf.FlagChangeEvent],
	logDataSourceOutageAsErrorAfter time.Duration,
	loggers ldlog.Loggers,
) *DataSourceUpdateSinkImpl

NewDataSourceUpdateSinkImpl creates the internal implementation of DataSourceUpdateSink.

func (*DataSourceUpdateSinkImpl) GetDataStoreStatusProvider

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

func (*DataSourceUpdateSinkImpl) GetLastStatus

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

GetLastStatus is used internally by SDK components.

func (*DataSourceUpdateSinkImpl) Init

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

func (*DataSourceUpdateSinkImpl) UpdateStatus

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

func (*DataSourceUpdateSinkImpl) Upsert

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

type PollingConfig

type PollingConfig struct {
	BaseURI      string
	PollInterval time.Duration
	FilterKey    string
}

PollingConfig describes the configuration for a polling data source. It is exported so that it can be used in the PollingDataSourceBuilder.

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 subsystems.ClientContext,
	dataSourceUpdates subsystems.DataSourceUpdateSink,
	cfg PollingConfig,
) *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) GetFilterKey

func (pp *PollingProcessor) GetFilterKey() string

GetFilterKey returns the configured filter key, 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 Requester

type Requester interface {
	Request() (data []ldstoretypes.Collection, cached bool, err error)
	BaseURI() string
	FilterKey() string
}

Requester allows PollingProcessor to delegate fetching data to another component. This is useful for testing the PollingProcessor without needing to set up a test HTTP server.

type StreamConfig

type StreamConfig struct {
	URI                   string
	FilterKey             string
	InitialReconnectDelay time.Duration
}

StreamConfig describes the configuration for a streaming data source. It is exported so that it can be used in the StreamingDataSourceBuilder.

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 subsystems.ClientContext,
	dataSourceUpdates subsystems.DataSourceUpdateSink,
	cfg StreamConfig,
) *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) GetFilterKey

func (sp *StreamProcessor) GetFilterKey() string

GetFilterKey returns the configured key, 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