-
Notifications
You must be signed in to change notification settings - Fork 11
chore: add DataSourceUpdatesSinkV2 support to DataSourceUpdatesImpl #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tanderson-ld
merged 2 commits into
main
from
ta/SDK-1608/datasource-updates-sinkv2-support
Jan 16, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For reviewers: I had accidentally removed these previously. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...k/server/src/main/java/com/launchdarkly/sdk/server/subsystems/DataSourceUpdateSinkV2.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| package com.launchdarkly.sdk.server.subsystems; | ||
|
|
||
| import com.launchdarkly.sdk.server.interfaces.DataSourceStatusProvider; | ||
| import com.launchdarkly.sdk.server.interfaces.DataSourceStatusProvider.ErrorInfo; | ||
| import com.launchdarkly.sdk.server.interfaces.DataSourceStatusProvider.State; | ||
| import com.launchdarkly.sdk.server.interfaces.DataStoreStatusProvider; | ||
|
|
||
| /** | ||
| * Interfaces required by data source updates implementations in FDv2. | ||
| * <p> | ||
| * This interface extends {@link TransactionalDataSourceUpdateSink} to add status tracking | ||
| * and status update capabilities required for FDv2 data sources. | ||
| * <p> | ||
| * This interface is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. | ||
| * It is in early access. If you want access to this feature please join the EAP. https://launchdarkly.com/docs/sdk/features/data-saving-mode | ||
| * | ||
| * @since 5.0.0 | ||
| * @see TransactionalDataSourceUpdateSink | ||
| * @see DataSource | ||
| */ | ||
| public interface DataSourceUpdateSinkV2 extends TransactionalDataSourceUpdateSink { | ||
| /** | ||
| * An object that provides status tracking for the data store, if applicable. | ||
| * <p> | ||
| * 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. | ||
| * | ||
| * @return a {@link DataStoreStatusProvider} | ||
| */ | ||
| DataStoreStatusProvider getDataStoreStatusProvider(); | ||
|
|
||
| /** | ||
| * Informs the SDK of a change in the data source's status. | ||
| * <p> | ||
| * 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. | ||
| * <p> | ||
| * If {@code newState} is different from the previous state, and/or {@code newError} is non-null, the | ||
| * SDK will start returning the new status (adding a timestamp for the change) from | ||
| * {@link DataSourceStatusProvider#getStatus()}, and will trigger status change events to any | ||
| * registered listeners. | ||
| * <p> | ||
| * A special case is that if {@code newState} is {@link State#INTERRUPTED}, | ||
| * but the previous state was {@link State#INITIALIZING}, the state will | ||
| * remain at {@link State#INITIALIZING} because {@link State#INTERRUPTED} | ||
| * is only meaningful after a successful startup. | ||
| * | ||
| * @param newState the data source state | ||
| * @param newError information about a new error, if any | ||
| * @see DataSourceStatusProvider | ||
| */ | ||
| void updateStatus(State newState, ErrorInfo newError); | ||
| } | ||
|
|
32 changes: 32 additions & 0 deletions
32
...c/main/java/com/launchdarkly/sdk/server/subsystems/TransactionalDataSourceUpdateSink.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package com.launchdarkly.sdk.server.subsystems; | ||
|
|
||
| import com.launchdarkly.sdk.server.subsystems.DataStoreTypes.ChangeSet; | ||
| import com.launchdarkly.sdk.server.subsystems.DataStoreTypes.ItemDescriptor; | ||
|
|
||
| /** | ||
| * Interface that an implementation of {@link DataSource} will use to push data into the SDK transactionally. | ||
| * <p> | ||
| * 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. | ||
| * <p> | ||
| * Component factories for {@link DataSource} implementations will receive an implementation of this | ||
| * interface in the {@link ClientContext#getDataSourceUpdateSink()} property of {@link ClientContext}. | ||
| * <p> | ||
| * This interface is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. | ||
| * It is in early access. If you want access to this feature please join the EAP. https://launchdarkly.com/docs/sdk/features/data-saving-mode | ||
| * | ||
| * @since 5.0.0 | ||
| * @see DataSource | ||
| * @see ClientContext | ||
| */ | ||
| public interface TransactionalDataSourceUpdateSink { | ||
| /** | ||
| * Apply the given change set to the store. This should be done atomically if possible. | ||
| * | ||
| * @param changeSet the changeset to apply | ||
| * @return true if the update succeeded, false if it failed | ||
| */ | ||
| boolean apply(ChangeSet<ItemDescriptor> changeSet); | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be duplicating this notification, but we can sort the correct layering once we have things connected together.