Documentation ¶
Overview ¶
Package store contains the internal implementation of how Relay interacts with the SDK's DataStore to detect data updates.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataStoreProvider ¶
type DataStoreProvider interface { // GetStore returns the current data store, or nil if it has not been created. GetStore() subsystems.DataStore }
DataStoreProvider is an interface implemented by SSERelayDataStoreAdapter, describing a component that may or may not yet have a data store.
type SSERelayDataStoreAdapter ¶
type SSERelayDataStoreAdapter struct {
// contains filtered or unexported fields
}
SSERelayDataStoreAdapter is used to create the data store wrapper that manages updates. When data is updated in the underlying store, it calls methods of EnvStreams to broadcast the updates.
Because the SDK normally wants to manage the lifecycle of its components, it requires you to provide a factory for any custom component, rather than an instance of the component itself. Then it asks the factory to create the instance when the LDClient is created. However, in this case we want to be able to access the instance externally.
Also, since streamUpdatesStoreWrapper is a wrapper for an underlying data store that could be a database, we need to be able to specify which data store implementation is being used - also as a factory.
So, this factory implementation - which should only be used for a single client at a time - calls the wrapped factory to produce the underlying data store, then creates our own store instance, and then puts a reference to that instance inside itself where we can see it.
func NewSSERelayDataStoreAdapter ¶
func NewSSERelayDataStoreAdapter( wrappedFactory subsystems.ComponentConfigurer[subsystems.DataStore], updates streams.EnvStreamUpdates, ) *SSERelayDataStoreAdapter
NewSSERelayDataStoreAdapter creates a new instance where the store has not yet been created.
func (*SSERelayDataStoreAdapter) Build ¶
func (a *SSERelayDataStoreAdapter) Build( context subsystems.ClientContext, ) (subsystems.DataStore, error)
Build is called by the SDK when the LDClient is being created.
func (*SSERelayDataStoreAdapter) GetStore ¶
func (a *SSERelayDataStoreAdapter) GetStore() subsystems.DataStore
GetStore returns the current data store, or nil if it has not been created.
func (*SSERelayDataStoreAdapter) GetUpdates ¶
func (a *SSERelayDataStoreAdapter) GetUpdates() streams.EnvStreamUpdates
GetUpdates returns the EnvStreamUpdates that will receive all updates sent to this store. This is exposed for testing so that we can simulate receiving updates from LaunchDarkly to this component.