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

New handle_aux/5 API that provides a better and safer API into Ra internals. #414

Merged
merged 5 commits into from
Feb 19, 2024

Conversation

kjnilsson
Copy link
Contributor

@kjnilsson kjnilsson commented Jan 29, 2024

ra_machine:handle_aux/6 callback was experimental and provided both too much access to the log internals as well as not enough access to ra server state such as membership information. This PR addresses this with a new ra_machine:handle_aux/5 callback that should be preferred going forward. This is accompanied with a new module ra_aux that provides a safe API to query and interact with the ra log and ra server internal state.

-callback handle_aux(ra_server:ra_state(),
                     {call, From :: from()} | cast,
                     Command :: term(),
                     AuxState,
                     State) ->
    {reply, Reply :: term(), AuxState, State} |
    {reply, Reply :: term(), AuxState, State, effects()} |
    {no_reply, AuxState, State} |
    {no_reply, AuxState, State, effects()}
      when AuxState :: term(),
           State :: ra_aux:state().

@michaelklishin michaelklishin modified the milestones: 2.10.0, 2.9.1 Jan 29, 2024
@kjnilsson kjnilsson changed the title move state query to ra_server New handle_aux/5 API that provides a better and safer API into Ra internals. Feb 7, 2024
@dumbbell dumbbell modified the milestones: 2.9.1, 2.10.0 Feb 12, 2024
@the-mikedavis the-mikedavis self-requested a review February 13, 2024 14:21
That replaces handle_aux/6

Adds ra_aux for interacting safely with the
internal state and log.

Move state query to ra_server

The appropriate handle_aux function to use is re-evaluated every
time the effective machine module changes and is stored in the
ra_server configuration state.
And remove duplicated information from INTERNALS.md
@kjnilsson kjnilsson marked this pull request as ready for review February 16, 2024 14:06
src/ra_log.erl Show resolved Hide resolved
src/ra_machine.erl Outdated Show resolved Hide resolved
src/ra_server.erl Show resolved Hide resolved
src/ra_server.erl Outdated Show resolved Hide resolved
@kjnilsson kjnilsson merged commit fc394fc into main Feb 19, 2024
7 checks passed
@dumbbell dumbbell deleted the aux-improvements branch July 9, 2024 15:18
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.

4 participants