Interface IDataSourceUpdates
Interface that an implementation of IDataSource will use to push data into the SDK.
Namespace: LaunchDarkly.Sdk.Server.Subsystems
Assembly: LaunchDarkly.ServerSdk.dll
Syntax
public interface IDataSourceUpdates
Remarks
The data source interacts with this object, rather than manipulating the data store directly, so that the SDK can perform any other necessary operations that must happen when data is updated. This object also provides a mechanism to report status changes.
Component factories for IDataSource implementations will receive an implementation of this interface in the DataSourceUpdates property of LdClientContext.
Properties
| Edit this page View SourceDataStoreStatusProvider
An object that provides status tracking for the data store, if applicable.
Declaration
IDataStoreStatusProvider DataStoreStatusProvider { get; }
Property Value
Type | Description |
---|---|
IDataStoreStatusProvider |
Remarks
This may be useful if the data source needs to be aware of storage problems that might require it to take some special action: for instance, if a database outage may have caused some data to be lost and therefore the data should be re-requested from LaunchDarkly.
Methods
| Edit this page View SourceInit(FullDataSet<ItemDescriptor>)
Completely overwrites the current contents of the data store with a set of items for each collection.
Declaration
bool Init(DataStoreTypes.FullDataSet<DataStoreTypes.ItemDescriptor> allData)
Parameters
Type | Name | Description |
---|---|---|
DataStoreTypes.FullDataSet<DataStoreTypes.ItemDescriptor> | allData | a list of DataStoreTypes.DataKind instances and their corresponding data sets |
Returns
Type | Description |
---|---|
bool | true if the update succeeded, false if it failed |
UpdateStatus(DataSourceState, ErrorInfo?)
Informs the SDK of a change in the data source's status.
Declaration
void UpdateStatus(DataSourceState newState, DataSourceStatus.ErrorInfo? newError)
Parameters
Type | Name | Description |
---|---|---|
DataSourceState | newState | the data source state |
DataSourceStatus.ErrorInfo? | newError | information about a new error, if any |
Remarks
Data source implementations should use this method if they have any concept of being in a valid state, a temporarily disconnected state, or a permanently stopped state.
If newState
is different from the previous state, and/or newError
is non-null, the SDK will start returning the new status(adding a timestamp for the change) from
Status, and will trigger status change events to any
registered listeners.
A special case is that if newState
is Interrupted,
but the previous state was Initializing, the state will
remain at Initializing because
Interrupted is only meaningful after a successful startup.
See Also
| Edit this page View SourceUpsert(DataKind, string, ItemDescriptor)
Updates or inserts an item in the specified collection. For updates, the object will only be updated if the existing version is less than the new version.
Declaration
bool Upsert(DataStoreTypes.DataKind kind, string key, DataStoreTypes.ItemDescriptor item)
Parameters
Type | Name | Description |
---|---|---|
DataStoreTypes.DataKind | kind | specifies which collection to use |
string | key | the unique key for the item within that collection |
DataStoreTypes.ItemDescriptor | item | the item to insert or update |
Returns
Type | Description |
---|---|
bool | true if the update succeeded, false if it failed |
Remarks
The DataStoreTypes.ItemDescriptor may contain a null, to represent a placeholder for a deleted item.