-
Notifications
You must be signed in to change notification settings - Fork 79
Add new interfaces to improve data consuming performance. (#65) #66
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
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.
How about returning a value? e.g.
std::string releaseData();Though the output parameter is widely used in Pulsar C++ client, it's because the returned value is Result. In this case, using an output parameter looks ugly IMO.
RobertIndie
left a comment
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.
Please add some unit tests.
|
@tongsucn Please rebase the main branch to pass the failed job. |
…pop is called on a read-only SharedBuffer. (apache#65)
5df859a to
f99c37a
Compare
Done |
| ASSERT_FALSE(strncmp("content", (char*)msg.getData(), msg.getLength())); | ||
| ASSERT_EQ(content, (char*)msg.getData()); | ||
|
|
||
| ASSERT_THROW(msg.releaseData(), std::runtime_error); |
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.
Please add a test case for releasing the data successfully and verify the data is actually swapped.
|
@BewareMyPower @shibd @RobertIndie I found a problem on the new interface: When batching is enabled on producer side, It means that the messages from a batch cannot be moved into another |
|
@tongsucn Good point. I think it's determined by how do you use that. If you only want a view of the Message's value, you can create an instance If you want some extra in place operations, I think you can expose the non-const const void* getData() const;
void* getData(); // new interfaceIf your process function in application just accepts a |
|
I just found the |
Well, I think the result of Under current design, |
Fixes #65
Motivation
Improve data consuming performance by adding new interfaces on
class Messageandclass SharedBuffer.Modifications
Adding two functions:
lib/SharedBuffer.hpulsar/Message.h,lib/Message.ccstd::string Message::release()Verifying this change
This change added tests and can be verified as follows:
Run client's unit test, it's added in
MessageTest.cc.Documentation
doc-required(Your PR needs to update docs and you will update later)
doc-not-needed(Please explain why)
doc(Your PR contains doc changes)
doc-complete(Docs have been already added)