-
Notifications
You must be signed in to change notification settings - Fork 139
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
[WIP]Performance[mqbi::DispatcherEvent]: replace multiple inheritance with variant #396
base: main
Are you sure you want to change the base?
Conversation
e16b562
to
ef96296
Compare
DispatcherEvent& setType(DispatcherEventType::Enum value); | ||
inline DispatcherPutEvent& makePutEvent() | ||
{ | ||
d_type = DispatcherEventType::e_PUT; |
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.
Do we even need to set this type anymore?
bsl::shared_ptr<bdlbb::Blob> d_blob_sp; | ||
// Blob of data embedded in this | ||
// event. Refer to the corresponding | ||
// accessor on the various | ||
// DispatcherEvent view interfaces | ||
// for more specific information. |
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.
bsl::shared_ptr<bdlbb::Blob> d_blob_sp; | |
// Blob of data embedded in this | |
// event. Refer to the corresponding | |
// accessor on the various | |
// DispatcherEvent view interfaces | |
// for more specific information. | |
/// Blob of data embedded in this | |
/// event. Refer to the corresponding | |
/// accessor on the various | |
/// DispatcherEvent view interfaces | |
/// for more specific information. | |
bsl::shared_ptr<bdlbb::Blob> d_blob_sp; |
Docstring style
{ | ||
// NOTHING | ||
} | ||
|
||
/// Destructor. | ||
virtual ~DispatcherAckEvent(); |
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.
Do we need virtual destructors still?
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, will clean up this
// TODO refactor | ||
if (mqbi::DispatcherEventType::e_PUSH == ev.type()) { | ||
const_cast<mqbi::DispatcherPushEvent*>(ev.asPushEvent()) | ||
->setClusterNode(d_clusterNode_p); |
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.
Is the refactoring here to make asPushEvent
and family to have a const and non-const overload?
.setType(mqbi::DispatcherEventType::e_CALLBACK) | ||
.setCallback(mqbi::Dispatcher::voidToProcessorFunctor(f)) | ||
.setDestination(const_cast<mqbi::DispatcherClient*>(d_client_p)); | ||
.setDestination(const_cast<mqbi::DispatcherClient*>(d_client_p)) |
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.
Little wary of this const cast, what's the reason this is okay?
.setSource(this) | ||
.makePushEvent() | ||
.setBlob(appData) | ||
.setOptions(options) | ||
.setGuid(msgGUID) |
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.
Note that initially we are building DispatcherEvent
, and after makePushEvent()
we are calling setters for DispatcherPushEvent
. So we switch between objects amidst these setters calls. This interface is not perfect, but I have plans to replace it by calling constructors with all args instead.
So instead of this
(*dispEvent)
.setSource(this) // DispatcherEvent
.makePushEvent() // !!! DispatcherPushEvent
.setBlob(appData) // DispatcherPushEvent
.setOptions(options) // DispatcherPushEvent
.setGuid(msgGUID) // DispatcherPushEvent
We will have smth like this:
(*dispEvent)
.setSource(this)
.makePushEvent(appData, options, msgGUID, ...)
I plan to do it in a separate PR, with performance benchmarks, to limit the number of changes in this PR.
5870886
to
adf9611
Compare
9c1186a
to
4f7f605
Compare
4f7f605
to
2f56f75
Compare
Signed-off-by: Evgeny Malygin <[email protected]>
2f56f75
to
6f1e149
Compare
Signed-off-by: Evgeny Malygin <[email protected]>
6f1e149
to
4968e09
Compare
Before
After