important: arrange transaction scope in NodeImpl
Raft-rs interface requires the application to process special structure, the so-called "ready state". It also makes a demand on the processing workflow. The fields must be processed in a certain sequence, see https://docs.rs/raft/0.6.0/raft/index.html#processing-the-ready-state.
For example, it was a mistake to send persisted_messages
inside a
transaction, because it's forbidded to do so before persisting the hard
state, but the actual write happens only in the end of transaction.
As for handling soft_state
and read_states
, they're useless in a
transaction as they don't persist anything.
The documentation is quite complicated, so this code might be revised once again later.