-
Notifications
You must be signed in to change notification settings - Fork 143
Delta XDS - improved #166
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
Delta XDS - improved #166
Changes from 29 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
9338246
delta xds
sschepens 417efe7
fixes
sschepens a63a066
method naming
sschepens dcc5468
Building version of non-breaking changes
3f59306
Get integration tests passing
583c213
Add delta tests back
530814e
Rewrite V3DiscoveryServerAdsDeltaResourcesIT to have a 2 second poll …
4437256
Add comment to trigger PR build
cb43523
Get V3DiscoveryServerXdsDeltaResourcesIT passing
5838a4f
Update protobuf to envoy 1.16.0 (#155)
wookieJ 9f8ca58
release: prepare release v0.1.25
envoy-bot a30683a
release: prepare for next development iteration
envoy-bot 17c710a
release: prepare release v0.1.26
envoy-bot 471fa83
release: prepare for next development iteration
envoy-bot 5715e16
Bump nexus release plugin timeout to 20 minutes (#156)
slonka 4d9b2c7
release: prepare release v0.1.27
envoy-bot 443becf
release: prepare for next development iteration
envoy-bot 6197daa
ci: fixes javadoc and jacoco plugin issues (#158)
listaction 5af4b8f
Update api to v1 17 (#159)
3f0a633
Fix references to main branch after rename (#160)
slonka ab63a8c
release: prepare release v0.1.28
envoy-bot 00d4d88
release: prepare for next development iteration
envoy-bot 888dbee
Change version to 0.1.29-delta-xds-slonka-SNAPSHOT
slonka 28d2481
Revert ads configs to main
slonka d31054b
Hash bytes array not string
slonka 7941164
Remove unused import
slonka bac2a72
Revert snapshot name
slonka ea87f9f
Merge branch 'main' of github.com:envoyproxy/java-control-plane into …
slonka e6e22eb
Remove respondDeltaTracked since it's not used anywhere
slonka 93293e3
Delta xds non breaking hash bytes refactor (#181)
Ferdudas97 4321240
Change version to 0.1.29-delta-xds-slonka-SNAPSHOT
Ferdudas97 15a4247
DEPLOY_BRANCH added for snapshot deploy
Ferdudas97 63eb59f
Merge remote-tracking branch 'origin/main' into delta-xds-non-breakin…
Ferdudas97 ae47beb
Merge remote-tracking branch 'origin/main' into delta-xds-non-breakin…
Ferdudas97 11680aa
changes after merge master with new envoy api
Ferdudas97 18957d4
Merge remote-tracking branch 'origin/main' into delta-xds-non-breakin…
Ferdudas97 2405bd1
make CacheStatusInfoAggregator public
Ferdudas97 5c734c2
Merge remote-tracking branch 'origin/main' into delta-xds-non-breakin…
Ferdudas97 2ca8d94
make GroupCacheStatusInfo and MutableStatusInfo public
Ferdudas97 3bb76ee
refactor SimpleCache
Ferdudas97 1696cd5
Merge remote-tracking branch 'origin/main' into delta-xds-non-breakin…
Ferdudas97 3087413
create resources map only once
Ferdudas97 68d2764
build snapshot with improved performance
Ferdudas97 608c21c
refactor creating snapshot resources due to performance improvements
Ferdudas97 6136bf2
create hash version from string
Ferdudas97 ed414d6
Merge remote-tracking branch 'origin/main' into delta-xds-non-breakin…
Ferdudas97 5239443
remove custom snapshot version and deploy branch env
Ferdudas97 0292929
Merge remote-tracking branch 'origin/main' into delta-xds-non-breakin…
Ferdudas97 fc131d5
fix test after merge
Ferdudas97 fdc7425
fix V3DeltaDiscoveryServerCallbacks description
Ferdudas97 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
41 changes: 41 additions & 0 deletions
41
cache/src/main/java/io/envoyproxy/controlplane/cache/DeltaResponse.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,41 @@ | ||
package io.envoyproxy.controlplane.cache; | ||
|
||
import com.google.auto.value.AutoValue; | ||
import com.google.protobuf.Message; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* {@code Response} is a data class that contains the response for an assumed configuration type. | ||
*/ | ||
@AutoValue | ||
public abstract class DeltaResponse { | ||
|
||
public static DeltaResponse create(DeltaXdsRequest request, | ||
Map<String, VersionedResource<?>> resources, | ||
List<String> removedResources, | ||
String version) { | ||
return new AutoValue_DeltaResponse(request, resources, removedResources, version); | ||
} | ||
|
||
/** | ||
* Returns the original request associated with the response. | ||
*/ | ||
public abstract DeltaXdsRequest request(); | ||
|
||
/** | ||
* Returns the resources to include in the response. | ||
*/ | ||
public abstract Map<String, VersionedResource<? extends Message>> resources(); | ||
|
||
/** | ||
* Returns the removed resources to include in the response. | ||
*/ | ||
public abstract List<String> removedResources(); | ||
|
||
/** | ||
* Returns the version of the resources as tracked by the cache for the given type. Envoy responds with this version | ||
* as an acknowledgement. | ||
*/ | ||
public abstract String version(); | ||
} |
121 changes: 121 additions & 0 deletions
121
cache/src/main/java/io/envoyproxy/controlplane/cache/DeltaWatch.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,121 @@ | ||
package io.envoyproxy.controlplane.cache; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; | ||
import java.util.function.Consumer; | ||
|
||
/** | ||
* {@code Watch} is a dedicated stream of configuration resources produced by the configuration cache and consumed by | ||
* the xDS server. | ||
*/ | ||
public class DeltaWatch { | ||
private static final AtomicIntegerFieldUpdater<DeltaWatch> isCancelledUpdater = | ||
AtomicIntegerFieldUpdater.newUpdater(DeltaWatch.class, "isCancelled"); | ||
private final DeltaXdsRequest request; | ||
private final Consumer<DeltaResponse> responseConsumer; | ||
private final Map<String, String> resourceVersions; | ||
private final Set<String> pendingResources; | ||
private final boolean isWildcard; | ||
private final String version; | ||
private volatile int isCancelled = 0; | ||
private Runnable stop; | ||
|
||
/** | ||
* Construct a watch. | ||
* | ||
* @param request the original request for the watch | ||
* @param version indicates the stream current version | ||
* @param isWildcard indicates if the stream is in wildcard mode | ||
* @param responseConsumer handler for outgoing response messages | ||
*/ | ||
public DeltaWatch(DeltaXdsRequest request, | ||
Map<String, String> resourceVersions, | ||
Set<String> pendingResources, | ||
String version, | ||
boolean isWildcard, | ||
Consumer<DeltaResponse> responseConsumer) { | ||
this.request = request; | ||
this.resourceVersions = resourceVersions; | ||
this.pendingResources = pendingResources; | ||
this.version = version; | ||
this.isWildcard = isWildcard; | ||
this.responseConsumer = responseConsumer; | ||
} | ||
|
||
/** | ||
* Cancel the watch. A watch must be cancelled in order to complete its resource stream and free resources. Cancel | ||
* may be called multiple times, with each subsequent call being a no-op. | ||
*/ | ||
public void cancel() { | ||
if (isCancelledUpdater.compareAndSet(this, 0, 1)) { | ||
if (stop != null) { | ||
stop.run(); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Returns boolean indicating whether or not the watch has been cancelled. | ||
*/ | ||
public boolean isCancelled() { | ||
return isCancelledUpdater.get(this) == 1; | ||
} | ||
|
||
/** | ||
* Returns the original request for the watch. | ||
*/ | ||
public DeltaXdsRequest request() { | ||
return request; | ||
} | ||
|
||
/** | ||
* Returns the tracked resources for the watch. | ||
*/ | ||
public Map<String, String> trackedResources() { | ||
return resourceVersions; | ||
} | ||
|
||
/** | ||
* Returns the pending resources for the watch. | ||
*/ | ||
public Set<String> pendingResources() { | ||
return pendingResources; | ||
} | ||
|
||
/** | ||
* Returns the stream current version. | ||
*/ | ||
public String version() { | ||
return version; | ||
} | ||
|
||
/** | ||
* Indicates if the stream is in wildcard mode. | ||
*/ | ||
public boolean isWildcard() { | ||
return isWildcard; | ||
} | ||
|
||
/** | ||
* Sends the given response to the watch's response handler. | ||
* | ||
* @param response the response to be handled | ||
* @throws WatchCancelledException if the watch has already been cancelled | ||
*/ | ||
public void respond(DeltaResponse response) throws WatchCancelledException { | ||
if (isCancelled()) { | ||
throw new WatchCancelledException(); | ||
} | ||
|
||
responseConsumer.accept(response); | ||
} | ||
|
||
/** | ||
* Sets the callback method to be executed when the watch is cancelled. Even if cancel is executed multiple times, it | ||
* ensures that this stop callback is only executed once. | ||
*/ | ||
public void setStop(Runnable stop) { | ||
this.stop = stop; | ||
} | ||
} |
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.
WDYT about making 2 different implementations
DeltaCacheStatusInfo
andCacheStatusInfo
that implements same methods? We would havelastWatchRequestTime
for both depends on implementation.