chenBright commented on code in PR #3198:
URL: https://github.com/apache/brpc/pull/3198#discussion_r2701003148
##########
src/brpc/selective_channel.h:
##########
@@ -69,8 +69,19 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
// On success, handle is set with the key for removal.
// NOTE: Different from pchan, schan can add channels at any time.
// Returns 0 on success, -1 otherwise.
- int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle);
- int AddChannel(ChannelBase* sub_channel, const std::string& tag,
ChannelHandle* handle);
+ int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle) {
+ return AddChannel(sub_channel, "", OWNS_CHANNEL, handle);
+ }
+ int AddChannel(ChannelBase* sub_channel, const std::string& tag,
+ ChannelHandle* handle) {
+ return AddChannel(sub_channel, tag, OWNS_CHANNEL, handle);
+ }
+ int AddChannel(ChannelBase* sub_channel, ChannelOwnership ownership,
+ ChannelHandle* handle) {
+ return AddChannel(sub_channel, "", ownership, handle);
+ }
+ int AddChannel(ChannelBase* sub_channel, const std::string& tag,
+ ChannelOwnership ownership, ChannelHandle* handle);
Review Comment:
I think AddChannel has a combinatorial explosion problem.
```c++
int AddChannel(SelectiveChannel::SubChannelOptions);
```
Using the SubChannelOptions overloaded AddChannel function would be more
suitable, as it offers better extensibility.
In the meantime, please update the comments for the AddChannel function.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]