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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void init​(java.util.Map<java.lang.String,​DataModel.Flag> items)
      Completely overwrites the current contents of the data store with a new set of items.
      void setStatus​(ConnectionInformation.ConnectionMode connectionMode, java.lang.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​(DataModel.Flag item)
      Updates or inserts an item.
    • Method Detail

      • init

        void init​(@NonNull
                  java.util.Map<java.lang.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
                    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
                       java.lang.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 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.