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

projections: Allow passing Horus options #209

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

the-mikedavis
Copy link
Member

The default Horus options used by khepri_projection:new/3 prevent unintentional non-determinism or interaction between processes. It could be useful to have an escape hatch for this, though. For example you might want to call persistent_term:get/2 and persistent_term:put/2 to create some lazy value to use in the projection function.

This change allows passing in horus:options() when creating a projection with khepri_projection:new/2. These options are merged with the defaults and passed to horus:to_standalone_fun/2.

The default Horus options used by `khepri_projection:new/3` prevent
unintentional non-determinism or interaction between processes. It could
be useful to have an escape hatch for this, though. For example you might
want to call `persistent_term:get/2` and `persistent_term:put/2` to
create some lazy value to use in the projection function.

This change allows passing in `horus:options()` when creating a
projection with `khepri_projection:new/2`. These options are merged with
the defaults and passed to `horus:to_standalone_fun/2`.
@the-mikedavis the-mikedavis added the enhancement New feature or request label Jun 13, 2023
@the-mikedavis the-mikedavis self-assigned this Jun 13, 2023
@codecov
Copy link

codecov bot commented Jun 13, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01 🎉

Comparison is base (9d95d5d) 89.31% compared to head (b38616d) 89.33%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
+ Coverage   89.31%   89.33%   +0.01%     
==========================================
  Files          20       20              
  Lines        2799     2803       +4     
==========================================
+ Hits         2500     2504       +4     
  Misses        299      299              
Flag Coverage Δ
erlang-24 88.29% <100.00%> (+0.01%) ⬆️
erlang-25 88.15% <100.00%> (-0.06%) ⬇️
erlang-26 88.94% <100.00%> (+0.01%) ⬆️
os-ubuntu-latest 89.33% <100.00%> (+0.01%) ⬆️
os-windows-latest 88.15% <100.00%> (+0.19%) ⬆️

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

Impacted Files Coverage Δ
src/khepri_projection.erl 83.54% <100.00%> (+0.87%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dumbbell dumbbell merged commit 5e917be into main Jun 15, 2023
10 checks passed
@dumbbell dumbbell deleted the pass-horus-options-for-projection-functions branch June 15, 2023 08:06
@dumbbell dumbbell added this to the v0.8.0 milestone Jul 26, 2023
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.

None yet

2 participants