Skip to content
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

Merged
merged 3 commits into from
Nov 20, 2023

Conversation

tisonkun
Copy link
Contributor

Just like take_prev_key for PutResponse.

I found this helper function help when HACKING GreptimeTeam/greptimedb#2734.

@tisonkun
Copy link
Contributor Author

cc @davidli2010

src/rpc/kv.rs Outdated Show resolved Hide resolved
@tisonkun tisonkun mentioned this pull request Nov 19, 2023
@tisonkun
Copy link
Contributor Author

@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 >_<

@davidli2010
Copy link
Contributor

@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.

@tisonkun
Copy link
Contributor Author

need to improve the implementation according to my comment

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()
Copy link
Contributor

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)) }

Copy link
Contributor Author

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 davidli2010 merged commit 6291b79 into etcdv3:master Nov 20, 2023
1 check passed
@tisonkun tisonkun deleted the impl-take_prev_kvs branch November 20, 2023 02:22
@tisonkun
Copy link
Contributor Author

@davidli2010 Thanks for your review. According to release on demand, perhaps I can expect a release in these days?

@davidli2010
Copy link
Contributor

v0.12.2 is released

@tisonkun
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants