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

khepri_adv, khepri_tx_adv: Always return khepri_adv:many_results() #303

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

dumbbell
Copy link
Member

@dumbbell dumbbell commented Oct 9, 2024

Why

Functions such as khepri_adv:get() and khepri_adv:put() extracted the single node's properties from the query/command return value and returned only that.

Therefore, the return value had a different form than other advanced functions' full node properties map.

In a future patch, we want to add the nodes deleted by the "expiration" of keep_while conditions. They can be deleted after a delete or a put. If we want to achieve that, we need to make all functions return the same thing.

How

All functions that returned the single node props value are simplified to return the whole map, regardless of the number of tree nodes in the map.

@dumbbell dumbbell added the enhancement New feature or request label Oct 9, 2024
@dumbbell dumbbell added this to the v0.17.0 milestone Oct 9, 2024
@dumbbell dumbbell self-assigned this Oct 9, 2024
@dumbbell dumbbell force-pushed the advanced-apis-all-return-node-props-map branch from 89e9807 to c17382b Compare October 9, 2024 16:25
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 97.36842% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.75%. Comparing base (c3897fb) to head (efc491c).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/khepri_tx.erl 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #303      +/-   ##
==========================================
+ Coverage   89.66%   89.75%   +0.08%     
==========================================
  Files          22       22              
  Lines        3251     3230      -21     
==========================================
- Hits         2915     2899      -16     
+ Misses        336      331       -5     
Flag Coverage Δ
erlang-25 88.97% <97.36%> (+0.29%) ⬆️
erlang-26 89.65% <97.36%> (+0.21%) ⬆️
erlang-27 89.41% <97.36%> (+0.11%) ⬆️
os-ubuntu-latest 89.75% <97.36%> (+0.14%) ⬆️
os-windows-latest 89.62% <97.36%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dumbbell dumbbell marked this pull request as ready for review October 9, 2024 19:30
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor typo I see in the second commit: "inser"=>"insert", otherwise I think this looks good 👍

@dumbbell dumbbell force-pushed the advanced-apis-all-return-node-props-map branch from c17382b to f71656a Compare October 11, 2024 12:35
[Why]
Functions such as `khepri_adv:get()` and `khepri_adv:put()` extracted
the single node's properties from the query/command return value and
returned only that.

Therefore, the return value had a different form than other advanced
functions' full node properties map.

In a future patch, we want to add the nodes deleted by the "expiration"
of `keep_while` conditions. They can be deleted after a delete or a put.
If we want to achieve that, we need to make all functions return the
same thing.

[How]
All functions that returned the single node props value are simplified
to return the whole map, regardless of the number of tree nodes in the
map.
[Why]
The projection needs a tuple to insert it in ETS in the end. Therefore
we can't use the `copy` method and store an atom. We need the projection
function to create that tuple.
@dumbbell dumbbell force-pushed the advanced-apis-all-return-node-props-map branch from f71656a to efc491c Compare October 11, 2024 14:48
@dumbbell
Copy link
Member Author

Just a minor typo I see in the second commit: "inser"=>"insert", otherwise I think this looks good 👍

Thank you! It is fixed.

@dumbbell dumbbell merged commit 5e89ae2 into main Oct 11, 2024
26 checks passed
@dumbbell dumbbell deleted the advanced-apis-all-return-node-props-map branch October 11, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants