(append-entries-response-event {:keys [other-server] :as raft-state}
{:keys [server request response]})
Updates raft state with an append-entries response. Responses may come out of order.
A few of the things that can happen:
Updates raft state with an append-entries response. Responses may come out of order. A few of the things that can happen: - If response has a newer term, we'll become a follower - If the response has success: true, we'll update that server's stats and possibly update the commit index - If the response has success: false, we'll decrement that server's next-index and resend a new append-entry to that server immediately with older log entries.
(close-leader raft-state)
(config-change-commit-response-event raft-state
{:keys [server request response]})
(config-change-response-event raft-state {:keys [server request response]})
(install-snapshot-response-event raft-state {:keys [server request response]})
Response map contains two keys:
Response map contains two keys: - term - current term of server - used to determine if we lost leadership - next-part - next part of the snapshot we should send, or nil/0 if we should send no more.
(is-leader? raft-state)
(new-command-event raft-state command-events)
Processes new commands. Only happens if currently a raft leader.
Processes new commands. Only happens if currently a raft leader.
(queue-add-server raft-state server)
(queue-append-entries raft-state)
Forces update messages for all servers to be placed in the queue. Called after a heartbeat timeout or when a commit index is updated. Resets heartbeat timeout.
Forces update messages for all servers to be placed in the queue. Called after a heartbeat timeout or when a commit index is updated. Resets heartbeat timeout.
(queue-apply-config-change raft-state request)
(queue-config-change {:keys [this-server other-servers] :as raft-state}
data
callback
op)
(recalc-commit-index servers)
Recalculates commit index and returns value given a server config map from raft. (:servers raft-state). Pulls all :match-index values and returns the minimum match index that the majority holds.
Recalculates commit index and returns value given a server config map from raft. (:servers raft-state). Pulls all :match-index values and returns the minimum match index that the majority holds.
(request-vote-response-event raft-state {:keys [server request response]})
(request-votes raft-state)
Request votes for leadership from all followers.
Request votes for leadership from all followers.
(update-commit raft-state)
(update-server-stats raft-state server response-time)
Updates some basic stats on servers when we receive a response.
Server stats have the following keys:
Updates some basic stats on servers when we receive a response. Server stats have the following keys: - sent - number of messages sent - received - number of responses received - avg-response - average response time in nanoseconds
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close