-
Notifications
You must be signed in to change notification settings - Fork 23
Added RBS support for SSE classes #547
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
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a68e2f6
Added RBS support for SSE classes
chillaq eb88ecd
Merge branch 'feature/rule-based-segment' into rbs-sse
chillaq 9f835ab
Update client/src/main/java/io/split/engine/common/SynchronizerImp.java
chillaq 73f1679
Update client/src/main/java/io/split/engine/common/SynchronizerImp.java
chillaq 8a2e2f4
Update client/src/main/java/io/split/engine/sse/workers/FeatureFlagWo…
chillaq f9dd3d5
polish
chillaq d6860b4
polish
chillaq bcf8014
polish
chillaq 8cccfa6
polish
chillaq 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
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
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
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
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
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
74 changes: 74 additions & 0 deletions
74
client/src/main/java/io/split/engine/sse/dtos/CommonChangeNotification.java
chillaq marked this conversation as resolved.
Show resolved
Hide resolved
|
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,74 @@ | ||
| package io.split.engine.sse.dtos; | ||
|
|
||
| import io.split.engine.segments.SegmentSynchronizationTaskImp; | ||
| import io.split.engine.sse.NotificationProcessor; | ||
| import io.split.engine.sse.enums.CompressType; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.UnsupportedEncodingException; | ||
| import java.util.Base64; | ||
| import java.util.zip.DataFormatException; | ||
|
|
||
| import static io.split.engine.sse.utils.DecompressionUtil.gZipDecompress; | ||
| import static io.split.engine.sse.utils.DecompressionUtil.zLibDecompress; | ||
|
|
||
| public class CommonChangeNotification extends IncomingNotification { | ||
| private static final Logger _log = LoggerFactory.getLogger(SegmentSynchronizationTaskImp.class); | ||
| private final long changeNumber; | ||
| private long previousChangeNumber; | ||
| private CompressType compressType; | ||
|
|
||
| public CommonChangeNotification(GenericNotificationData genericNotificationData, IncomingNotification.Type notificationType) { | ||
| super(notificationType, genericNotificationData.getChannel()); | ||
| changeNumber = genericNotificationData.getChangeNumber(); | ||
| if(genericNotificationData.getPreviousChangeNumber() != null) { | ||
| previousChangeNumber = genericNotificationData.getPreviousChangeNumber(); | ||
| } | ||
| compressType = CompressType.from(genericNotificationData.getCompressType()); | ||
| if (compressType == null || genericNotificationData.getFeatureFlagDefinition() == null) { | ||
| return; | ||
| } | ||
| try { | ||
| byte[] decodedBytes = Base64.getDecoder().decode(genericNotificationData.getFeatureFlagDefinition()); | ||
chillaq marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| switch (compressType) { | ||
| case GZIP: | ||
| decodedBytes = gZipDecompress(decodedBytes); | ||
| break; | ||
| case ZLIB: | ||
| decodedBytes = zLibDecompress(decodedBytes); | ||
| break; | ||
| } | ||
|
|
||
| updateDefinition(decodedBytes); | ||
| } catch (UnsupportedEncodingException | IllegalArgumentException e) { | ||
| _log.warn("Could not decode base64 data in definition", e); | ||
| } catch (DataFormatException d) { | ||
| _log.warn("Could not decompress definition with zlib algorithm", d); | ||
| } catch (IOException i) { | ||
| _log.warn("Could not decompress definition with gzip algorithm", i); | ||
| } | ||
| } | ||
|
|
||
| public long getChangeNumber() { | ||
| return changeNumber; | ||
| } | ||
| public long getPreviousChangeNumber() { | ||
| return previousChangeNumber; | ||
| } | ||
|
|
||
| public CompressType getCompressType() { | ||
| return compressType; | ||
| } | ||
|
|
||
| @Override | ||
| public void handler(NotificationProcessor notificationProcessor) {} | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return String.format("Type: %s; Channel: %s; ChangeNumber: %s", getType(), getChannel(), getChangeNumber()); | ||
| } | ||
|
|
||
| public void updateDefinition(byte[] decodedBytes) throws UnsupportedEncodingException {}; | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.