Skip to content

Commit

Permalink
ra_aux: Expose current_term
Browse files Browse the repository at this point in the history
With `current_term/1` (this change), `last_applied/1` and
`effective_machine_version/1` from the parent commit, the aux API
reflects essentially the same information as is passed as metadata to
the `RaMachine:apply/3` callback (`ra_machine:command_meta_data()`).
  • Loading branch information
the-mikedavis committed Oct 4, 2024
1 parent 55c9b81 commit ace731e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ra_aux.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
effective_machine_version/1,
leader_id/1,
last_applied/1,
current_term/1,
members_info/1,
overview/1,
log_last_index_term/1,
Expand Down Expand Up @@ -41,6 +42,10 @@ leader_id(State) ->
last_applied(State) ->
maps:get(?FUNCTION_NAME, State).

-spec current_term(ra_aux:internal_state()) -> ra_term().
current_term(State) ->
maps:get(?FUNCTION_NAME, State).

-spec members_info(ra_aux:internal_state()) -> ra_cluster().
members_info(State) ->
ra_server:state_query(?FUNCTION_NAME, State).
Expand Down

0 comments on commit ace731e

Please sign in to comment.