Interface DataSourceUpdateSink


public interface DataSourceUpdateSink
Interface that an implementation of DataSource will use to push data into the SDK.
Since:
4.0.0
  • Method Details

    • init

      void init(@NonNull LDContext context, @NonNull Map<String,DataModel.Flag> items)
      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

      void upsert(@NonNull LDContext context, @NonNull DataModel.Flag item)
      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 by ConnectionInformation.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 permanently shutting down and will send no more data.

      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.

      The data sources in this SDK do not call this method. They retry after a failure instead, and they wait longer after a failure that is unlikely to correct itself.