Liking cljdoc? Tell your friends :D

fluree.raft.leader


append-entries-response-eventclj

(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:

  • 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.
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.
raw docstring

close-leaderclj

(close-leader raft-state)

config-change-commit-response-eventclj

(config-change-commit-response-event raft-state
                                     {:keys [server request response]})

config-change-response-eventclj

(config-change-response-event raft-state {:keys [server request response]})

install-snapshot-response-eventclj

(install-snapshot-response-event raft-state {:keys [server request response]})

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.
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.
raw docstring

is-leader?clj

(is-leader? raft-state)

new-command-eventclj

(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.
raw docstring

queue-add-serverclj

(queue-add-server raft-state server)

queue-append-entriesclj

(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.
raw docstring

queue-apply-config-changeclj

(queue-apply-config-change raft-state request)

queue-config-changeclj

(queue-config-change {:keys [this-server other-servers] :as raft-state}
                     data
                     callback
                     op)

recalc-commit-indexclj

(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.
raw docstring

request-vote-response-eventclj

(request-vote-response-event raft-state {:keys [server request response]})

request-votesclj

(request-votes raft-state)

Request votes for leadership from all followers.

Request votes for leadership from all followers.
raw docstring

update-commitclj

(update-commit raft-state)

update-server-statsclj

(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:

  • sent - number of messages sent
  • received - number of responses received
  • avg-response - average response time in nanoseconds
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
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close