-
Notifications
You must be signed in to change notification settings - Fork 237
improve: filter only own updates for read-after-write-conistency #3414
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
Open
csviri
wants to merge
38
commits into
operator-framework:main
Choose a base branch
from
csviri:event-filter-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
c032552
improve: filter only own updates for read-after-write-conistency
csviri b9b2807
wip
csviri 236dc69
wip
csviri 5ec8f1d
wip
csviri b7ca3a8
Event filtering with recording
csviri 58b98e9
test fix
csviri 5ed32fa
Simplified EventHandling
csviri 52b29f0
unit tests fix
csviri 648ffff
small fix, test repeats
csviri cef1c32
improvements and releated unit tests
csviri 00ad4e4
cleanup
csviri 3059765
improve: filter only own updates for read-after-write-conistency with…
csviri c4b5f03
improvements on edge cases
csviri a200ad5
Potential fix for pull request finding
csviri 0723deb
delete related improvements and unit tests
csviri 9bb59a5
delete handling improvements and test improvements
csviri 1edea32
wip
csviri 9fee806
tests
csviri 8d1b665
test fix
csviri 44691d0
fix typo
csviri 639bf2a
Potential fix for pull request finding
csviri e567fcd
fixes
csviri f3595ac
improve: filter only own updates for read-after-write-conistency with…
csviri 3688639
test fixes
csviri 6a1ba58
logging and improvements
csviri 2a6f482
test AI identified cases
csviri bf3faec
fix: only filter own events
csviri c954fba
wip
csviri 8af288c
improvements and test fixes
csviri 60c9d5a
improvements
csviri 556234b
fix resource cache read
csviri 7663c2b
support for re-list
csviri f00eba7
simple algorithm, refined tests
csviri cf4b7b4
naming fix
csviri 09b03b8
small fixes
csviri dbc9f0f
cleanup
csviri 4e1b5f2
cleanup
csviri a7f3836
additional tests
csviri 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
72 changes: 0 additions & 72 deletions
72
...java/io/javaoperatorsdk/operator/processing/event/source/informer/EventFilterDetails.java
This file was deleted.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
...java/io/javaoperatorsdk/operator/processing/event/source/informer/EventFilterSupport.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,89 @@ | ||
| /* | ||
| * Copyright Java Operator SDK Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.javaoperatorsdk.operator.processing.event.source.informer; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
|
|
||
| import io.javaoperatorsdk.operator.processing.event.ResourceID; | ||
|
|
||
| public class EventFilterSupport { | ||
|
|
||
| private final Map<ResourceID, EventFilterWindow> eventFilterWindows = new HashMap<>(); | ||
| private boolean ongoingReList = false; | ||
|
|
||
| public synchronized void startEventFilteringModify(ResourceID resourceID) { | ||
| var ed = | ||
| eventFilterWindows.computeIfAbsent(resourceID, id -> new EventFilterWindow(ongoingReList)); | ||
| ed.increaseActiveUpdates(); | ||
| } | ||
|
|
||
| public synchronized Optional<GenericResourceEvent> doneEventFilterModify(ResourceID resourceID) { | ||
| var ed = eventFilterWindows.get(resourceID); | ||
| if (ed == null) return Optional.empty(); | ||
| ed.decreaseActiveUpdates(); | ||
| return check(ed, resourceID); | ||
| } | ||
|
|
||
| public synchronized Optional<GenericResourceEvent> processEvent( | ||
| ResourceID resourceId, GenericResourceEvent genericResourceEvent) { | ||
| var ed = eventFilterWindows.get(resourceId); | ||
| if (ed != null) { | ||
| ed.addRelatedEvent(genericResourceEvent); | ||
| return check(ed, resourceId); | ||
| } else { | ||
| return Optional.of(genericResourceEvent); | ||
| } | ||
| } | ||
|
|
||
| private Optional<GenericResourceEvent> check( | ||
| EventFilterWindow eventFilterWindow, ResourceID resourceID) { | ||
| var res = eventFilterWindow.check(); | ||
| if (eventFilterWindow.canBeRemoved()) { | ||
| eventFilterWindows.remove(resourceID); | ||
| } | ||
| return res; | ||
| } | ||
|
|
||
| public synchronized void addToOwnResourceVersions(ResourceID resourceId, String resourceVersion) { | ||
| Optional.ofNullable(eventFilterWindows.get(resourceId)) | ||
| .ifPresent(au -> au.addToOwnResourceVersions(resourceVersion)); | ||
| } | ||
|
|
||
| public synchronized void handleGhostResourceRemoval(ResourceID resourceId) { | ||
| eventFilterWindows.remove(resourceId); | ||
| } | ||
|
|
||
| // for testing purposes | ||
| synchronized Map<ResourceID, EventFilterWindow> getEventFilterWindows() { | ||
| return eventFilterWindows; | ||
| } | ||
|
|
||
| public synchronized void setStartingReList() { | ||
| ongoingReList = true; | ||
| eventFilterWindows.values().forEach(EventFilterWindow::setReListStarted); | ||
| } | ||
|
|
||
| public synchronized void setRelistFinished() { | ||
| ongoingReList = false; | ||
| eventFilterWindows.values().forEach(EventFilterWindow::setReListFinished); | ||
| } | ||
|
|
||
| public synchronized boolean isActiveUpdateFor(ResourceID resourceId) { | ||
| return eventFilterWindows.containsKey(resourceId); | ||
| } | ||
| } |
Oops, something went wrong.
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.