-
Notifications
You must be signed in to change notification settings - Fork 52
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
Implement take_prev_kvs for DeleteResponse #68
Conversation
Signed-off-by: tison <[email protected]>
cc @davidli2010 |
@davidli2010 Do you think this patch in a good direction? Also, I wonder if we have an estimate for a next release so that downstream can upgrade to a version with new patches >_< |
This PR is OK, but need to improve the implementation according to my comment. There is no regular release plan, just release as needed. |
I don't see extra comments yet. |
src/rpc/kv.rs
Outdated
/// If `prev_kvs` is set in the request, take the previous key-value pairs, leaving an empty vector in its place. | ||
#[inline] | ||
pub fn take_prev_kvs(&mut self) -> Vec<KeyValue> { | ||
self.0.prev_kvs.drain(..).map(KeyValue::new).collect() |
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 need to collect KeyValue into another vector, as DeleteResponse
/KeyValue
are just wrappers of PbDeleteResponse
/PbKeyValue
, here we can take and transmute prev_kvs to Vec:
unsafe { std::mem::transmute(std::mem::take(&mut self.0.prev_kvs)) }
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.
Updated.
Signed-off-by: tison <[email protected]>
@davidli2010 Thanks for your review. According to release on demand, perhaps I can expect a release in these days? |
v0.12.2 is released |
Thank you! |
Just like
take_prev_key
forPutResponse
.I found this helper function help when HACKING GreptimeTeam/greptimedb#2734.