Interface DataSourceUpdateSink
public interface DataSourceUpdateSink
Interface that an implementation of
DataSource
will use to push data into the SDK.- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
init
(LDContext context, Map<String, DataModel.Flag> items) Completely overwrites the current contents of the data store with a new set of items.void
setStatus
(ConnectionInformation.ConnectionMode connectionMode, Throwable failure) Informs the SDK of a change in the data source's status or the connection mode.void
shutDown()
Informs the SDK that the data source is being permanently shut down due to an unrecoverable problem reported by LaunchDarkly, such as the mobile key being invalid.void
upsert
(LDContext context, DataModel.Flag item) Updates or inserts an item.
-
Method Details
-
init
Completely overwrites the current contents of the data store with a new set of items.- Parameters:
items
- a map of flag keys to flag evaluation results
-
upsert
Updates or inserts an item. If an item already exists with the same key, the operation will only succeed if the existing version is less than the new version.If a flag has been deleted, the data source should pass a versioned placeholder created with
DataModel.Flag.deletedItemPlaceholder(String, int)
.- Parameters:
item
- the new evaluation result data (or a deleted item placeholder)
-
setStatus
void setStatus(@NonNull ConnectionInformation.ConnectionMode connectionMode, @Nullable Throwable failure) Informs the SDK of a change in the data source's status or the connection mode.- Parameters:
connectionMode
- the value that should be reported byConnectionInformation.getConnectionMode()
failure
- if non-null, represents an error/exception that caused data source initialization to fail
-
shutDown
void shutDown()Informs the SDK that the data source is being permanently shut down due to an unrecoverable problem reported by LaunchDarkly, such as the mobile key being invalid.This implies that the SDK should also stop other components that communicate with LaunchDarkly, such as the event processor. It also changes the connection mode to
ConnectionInformation.ConnectionMode.SHUTDOWN
.
-