-
Notifications
You must be signed in to change notification settings - Fork 4.1k
surpport tag for selective channel #3189
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,7 +51,10 @@ namespace brpc { | |
| // in `done'. | ||
| class SelectiveChannel : public ChannelBase/*non-copyable*/ { | ||
| public: | ||
| typedef SocketId ChannelHandle; | ||
| struct ChannelHandle { | ||
| SocketId id; | ||
| std::string tag; | ||
| }; | ||
|
|
||
| SelectiveChannel(); | ||
| ~SelectiveChannel(); | ||
|
|
@@ -67,9 +70,10 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ { | |
| // 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); | ||
|
|
||
| // Remove and destroy the sub_channel associated with `handle'. | ||
| void RemoveAndDestroyChannel(ChannelHandle handle); | ||
| void RemoveAndDestroyChannel(const ChannelHandle& handle); | ||
|
||
|
|
||
| // Send request by a sub channel. schan may retry another sub channel | ||
| // according to retrying/backup-request settings. | ||
|
|
||
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 is a breaking API change. The ChannelHandle type is changed from a simple typedef (SocketId) to a struct containing both id and tag. This breaks backward compatibility for existing code that treats ChannelHandle as a SocketId value. Users who pass ChannelHandle by value or compare it directly with SocketId will experience compilation errors. Consider whether a deprecation period or alternative approach would be more appropriate for this public API change.