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

Special-case trivial "copy"-style projections #204

Merged
merged 1 commit into from
May 5, 2023

Conversation

the-mikedavis
Copy link
Member

A common case for projection functions is to re-use each tree node's payload as the record for the projection ETS table. In terms of a simple projection, this is:

ProjectionFun = fun(_Path, Payload) -> Payload end

This change allows passing a special 'copy' atom to stand for this case. When triggering a projection we don't execute a Horus function so 'copy' projections have minimal overhead.

A common case for projection functions is to re-use each tree node's
payload as the record for the projection ETS table. In terms of a
simple projection, this is:

    fun(_Path, Payload) -> Payload end

This change allows passing a special 'copy' atom to stand for this
case. When triggering a projection we don't execute a Horus function
so 'copy' projections have minimal overhead.
@the-mikedavis the-mikedavis added the enhancement New feature or request label May 2, 2023
@the-mikedavis the-mikedavis self-assigned this May 2, 2023
@codecov
Copy link

codecov bot commented May 2, 2023

Codecov Report

Patch coverage: 91.66% and no project coverage change.

Comparison is base (e5b8753) 88.67% compared to head (45cf50a) 88.67%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #204   +/-   ##
=======================================
  Coverage   88.67%   88.67%           
=======================================
  Files          20       20           
  Lines        2781     2790    +9     
=======================================
+ Hits         2466     2474    +8     
- Misses        315      316    +1     
Flag Coverage Δ
erlang-24 88.27% <91.66%> (-0.07%) ⬇️
erlang-25 88.27% <91.66%> (+<0.01%) ⬆️
erlang-26.0-rc2 88.13% <91.66%> (-0.15%) ⬇️
os-ubuntu-latest 88.60% <91.66%> (-0.08%) ⬇️
os-windows-latest 88.27% <91.66%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
src/khepri_machine.erl 95.55% <ø> (ø)
src/khepri_projection.erl 84.12% <91.66%> (+0.79%) ⬆️

☔ 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 9ed206a into main May 5, 2023
12 checks passed
@dumbbell dumbbell deleted the copy-style-projections branch May 5, 2023 15:48
@dumbbell dumbbell added this to the v0.8.0 milestone May 5, 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