-
Notifications
You must be signed in to change notification settings - Fork 217
feat: remove primary to secondary mapper (handled automatically) #1161
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
Conversation
@metacosm I would actually put this into 3.0 since (if does not make trouble with quarkus extension), although its quite last minute, but simplifies usage a lot. |
@@ -28,9 +32,28 @@ public Optional<RetryInfo> getRetryInfo() { | |||
return Optional.ofNullable(retryInfo); | |||
} | |||
|
|||
@Override | |||
@SuppressWarnings("unchecked") | |||
public <T> List<T> getSecondaryResources(Class<T> expectedType) { |
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.
Shouldn't this be a Set instead of List, actually? Don't we want to return unique resources? Also, there's no ordering there so a List is not required.
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.
Fine with that will change.
import io.javaoperatorsdk.operator.processing.event.ResourceID; | ||
import io.javaoperatorsdk.operator.processing.event.source.SecondaryToPrimaryMapper; | ||
|
||
public class PrimaryToSecondaryIndex<R extends HasMetadata> { |
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.
This class should probably be package-private, no?
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.
No, it is also used by the user in case to define custom mapping. (We have default by owner reference, but that does not work for example outside of namespace. See also support in KubernetesDependentResource
.
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 don't understand what you mean. This class is only used by InformerEventSource
internally and since it's the class implementing the automated indexing of secondary resources, it shouldn't be exposed anyway.
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.
Sorry, I though this is the mapper. Yes this can be package private, will change it.
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.
fixed.
if (log.isDebugEnabled()) { | ||
log.debug("On delete event received for resource id: {}", ResourceID.fromResource(resource)); | ||
} | ||
primaryToSecondaryIndex.onAddOrUpdate(resource); |
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.
Shouldn't that be onDelete instead?
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.
uhh, yes, fixed thx.
} | ||
super.onDelete(resource, b); | ||
propagateEvent(resource); | ||
private boolean temporalCacheHasResourceWithVersionAs(R resource) { |
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.
private boolean temporalCacheHasResourceWithVersionAs(R resource) { | |
private boolean temporaryCacheHasResourceWithSameVersionAs(R resource) { |
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.
changed this separatelly in a commit, because here might break the build.
Kudos, SonarCloud Quality Gate passed! |
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.
LGTM
No description provided.