...

Package datasource

import "github.com/launchdarkly/go-server-sdk/v6/internal/datasource"
Overview
Index

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 ▾

func NewDataSourceStatusProviderImpl(broadcaster *internal.Broadcaster[interfaces.DataSourceStatus], dataSourceUpdates *DataSourceUpdateSinkImpl) interfaces.DataSourceStatusProvider
func NewNullDataSource() subsystems.DataSource
type DataSourceUpdateSinkImpl
    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
    func (d *DataSourceUpdateSinkImpl) GetDataStoreStatusProvider() intf.DataStoreStatusProvider
    func (d *DataSourceUpdateSinkImpl) GetLastStatus() intf.DataSourceStatus
    func (d *DataSourceUpdateSinkImpl) Init(allData []st.Collection) bool
    func (d *DataSourceUpdateSinkImpl) UpdateStatus(newState intf.DataSourceState, newError intf.DataSourceErrorInfo)
    func (d *DataSourceUpdateSinkImpl) Upsert(kind st.DataKind, key string, item st.ItemDescriptor) bool
type PollingProcessor
    func NewPollingProcessor(context subsystems.ClientContext, dataSourceUpdates subsystems.DataSourceUpdateSink, baseURI string, pollInterval time.Duration) *PollingProcessor
    func (pp *PollingProcessor) Close() error
    func (pp *PollingProcessor) GetBaseURI() string
    func (pp *PollingProcessor) GetPollInterval() time.Duration
    func (pp *PollingProcessor) IsInitialized() bool
    func (pp *PollingProcessor) Start(closeWhenReady chan<- struct{})
type StreamProcessor
    func NewStreamProcessor(context subsystems.ClientContext, dataSourceUpdates subsystems.DataSourceUpdateSink, streamURI string, initialReconnectDelay time.Duration) *StreamProcessor
    func (sp *StreamProcessor) Close() error
    func (sp *StreamProcessor) GetBaseURI() string
    func (sp *StreamProcessor) GetInitialReconnectDelay() time.Duration
    func (sp *StreamProcessor) IsInitialized() bool
    func (sp *StreamProcessor) Start(closeWhenReady chan<- struct{})

Package files

data_model_dependencies.go data_source_status_provider_impl.go data_source_update_sink_impl.go helpers.go null_data_source.go package_info.go polling_data_source.go requestor.go streaming_data_source.go streaming_data_source_events.go

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.

type DataSourceUpdateSinkImpl

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.

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

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 PollingProcessor

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.

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

func NewPollingProcessor

func NewPollingProcessor(
    context subsystems.ClientContext,
    dataSourceUpdates subsystems.DataSourceUpdateSink,
    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

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.

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

func NewStreamProcessor

func NewStreamProcessor(
    context subsystems.ClientContext,
    dataSourceUpdates subsystems.DataSourceUpdateSink,
    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{})