AntidoteDB / AntidoteDB/antidote
[QUESTION] prepare_done(State, Action) function
- Lenguaje dominante
- Erlang
- Estrellas
- 892
- Forks
- 92
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Hello 🙂
I have a quick question regarding the `prepare_done/2` function. More specifically, looking at [this line](https://github.com/AntidoteDB/antidote/blob/3014f1e44ba87efeabf9824e9de38c982181dbcd/src/clocksi_interactive_coord.erl#L915), I was wondering if it would not be interesting to refactor the function such that :
```
-define(NORMAL_COMMIT, <<1>>).
...
prepare_done(State, ?NORMAL_COMMIT, MaxPrepareTime) ->
prepare_done(?NORMAL_COMMIT,
length(State#state.updated_partitions),
State#state.transaction,
MaxPrepareTime);
prepare_done(?NORMAL_COMMIT, UpdatedPartitions, Transaction, MaxPrepareTime) ->
ok = ?CLOCKSI_VNODE:commit(UpdatedPartitions,
Transaction,
MaxPrepareTime),
{next_state, receive_committed,
State#state{
num_to_ack = UpdatedPartitions,
commit_time = MaxPrepareTime,
state = committing}}.
```
If I understand correctly, this could perhaps be a way to avoid passing the full state of the FSM across all helper functions and matching on multiple clauses in a single function with a `case` statement. I have not tested it but I was wondering if this might be a possible improvement ?
Igor
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.