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
MC: Add CP subsystem mgmt operations to client #16226
MC: Add CP subsystem mgmt operations to client #16226
Conversation
6e0d8fa
to
ce43c90
Compare
run-lab-run |
List<SimpleEntry<String, String>> result = new ArrayList<>(); | ||
for (CPMember cpMember : cpMembers) { | ||
String address = "[" + cpMember.getAddress().getHost() + "]:" + cpMember.getAddress().getPort(); | ||
result.add(new SimpleEntry<>(cpMember.getUuid().toString(), address)); |
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 have commented also in protocol pr. We should use uuid type in the protocol and avoid uuid to string conversion.
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.
The type was changed.
@sancar could you take another look at this PR tomorrow?
|
||
@Override | ||
public String getMethodName() { | ||
return "mcGetCPMembers"; |
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.
Needs to be getCPMembers
. We use the method name in the protocol definition. Same for other message tasks.
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.
My concern is potential collision with public client operations with the same name (getCPMembers
) that could be introduced in future. Do you think I should add mc
prefixes into client protocol for these methods, or it's fine to get rid of them here?
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.
That I don't know much about. Someone from the client team probably knows more. @asimarslan @sancar @ihsandemir what do you think?
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.
We are trying to match the method name to method name that user calls. If there is no User API, then the correct choice is not really well defined. In that sense, putting mc
prefix to avoid a future collision is a good choice.
Even if we are trying to match the names to protocol, I am not aware of it. @asimarslan What do you think ?
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.
As the correct approach is not certain, I've removed prefixes from #getMethodName
s.
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.
Looks good apart from one minor thing to fix.
21b7c3f
to
02021f0
Compare
nodeEngine.getHazelcastInstance().getCPSubsystem().getCPSubsystemManagementService(); | ||
return cpService.getCPMembers().toCompletableFuture() | ||
.thenApply(cpMembers -> { | ||
List<SimpleEntry<String, String>> result = new ArrayList<>(); |
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.
Why do we have List<Entry<String, String>>
here instead of CPMemberDTO
?
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.
That's because we have to deal with data types defined for codecs. And the general guideline in the client protocol generator is to avoid adding custom types where possible. That's why List<CPMember>
is represented as List<Map.Entry<String, String>>
.
A side note: it's going to change from List<Map.Entry<String, String>>
to List<Map.Entry<UUID, Address>>
(see comment from @sancar).
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.
got it. thx
a0671d6
to
c0bed93
Compare
run-lab-run |
1 similar comment
run-lab-run |
Merging this PR as the only failed test is a known issue and has nothing to do with local changes: |
getCPMembers
promoteToCPMember
removeCPMember
resetCPSubsystem
Protocol changes: hazelcast/hazelcast-client-protocol#276