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 ra_machine:overview/1 for khepri_machine #159

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

the-mikedavis
Copy link
Member

The overview callback formats the state of the machine for functions like sys:get_status/1. The actual state of the machine is still accessible with sys:get_state/1.

The status output was not very readable because of the beam code binaries in standalone_fun records and the use of records for nodes in the internal representation of the tree. This overview/1 implementation uses the map representation of the tree from khepri_utils:flat_struct_to_tree/1 and converts compiled standalone functions into regular functions with erlang:make_fun/3 (which are printed with a more concise and readable format).

The overview callback formats the state of the machine for functions
like `sys:get_status/1`. The actual state of the machine is still
accessible with `sys:get_state/1`.

The status output was not very readable because of the beam code
binaries in `standalone_fun` records and the use of records for nodes
in the internal representation of the tree. This `overview/1`
implementation uses the map representation of the tree from
`khepri_utils:flat_struct_to_tree/1` and converts compiled standalone
functions into regular functions with `erlang:make_fun/3` (which are
printed with a more concise and readable format).
@the-mikedavis the-mikedavis added the enhancement New feature or request label Oct 31, 2022
@the-mikedavis the-mikedavis self-assigned this Oct 31, 2022
@codecov
Copy link

codecov bot commented Oct 31, 2022

Codecov Report

Base: 90.97% // Head: 91.08% // Increases project coverage by +0.10% 🎉

Coverage data is based on head (797dbe5) compared to base (faa40f5).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #159      +/-   ##
==========================================
+ Coverage   90.97%   91.08%   +0.10%     
==========================================
  Files          16       16              
  Lines        2971     2983      +12     
==========================================
+ Hits         2703     2717      +14     
+ Misses        268      266       -2     
Flag Coverage Δ
erlang-24 89.60% <100.00%> (+<0.01%) ⬆️
erlang-25 89.67% <100.00%> (+0.17%) ⬆️
os-ubuntu-latest 91.08% <100.00%> (+0.17%) ⬆️
os-windows-latest 89.57% <100.00%> (+0.21%) ⬆️

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

Impacted Files Coverage Δ
src/khepri_fun.erl 93.53% <100.00%> (+0.02%) ⬆️
src/khepri_machine.erl 94.38% <100.00%> (+0.20%) ⬆️
src/khepri_utils.erl 98.98% <100.00%> (+0.02%) ⬆️
src/khepri_payload.erl 100.00% <0.00%> (+6.25%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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

Copy link
Member

@dumbbell dumbbell left a comment

Choose a reason for hiding this comment

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

Thanks!

@dumbbell dumbbell added this to the v0.6.0 milestone Nov 2, 2022
@dumbbell dumbbell merged commit 789a6ac into rabbitmq:main Nov 2, 2022
@the-mikedavis the-mikedavis deleted the md-overview branch November 2, 2022 12:08
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