OpenCyphal-Garage / cyraft

Raft algorithm (for pycyphal)
2 stars 2 forks source link

Update append entry methode #20

Open Parsifal22 opened 3 months ago

Parsifal22 commented 3 months ago

Now, the _server_append_entries method sends entries. If adding an element fails, it decrements the value of self._next_index[remote_node_index]. If adding the element succeeds, it increments this value. This way we avoid the case where the new leader rewrites all the logs anew, even if they already exist on the follower.

Additionally, the _serve_append_entries method was modified: new if-conditions were added, and the element removal function was moved from the _append_entries_processing method to this one.