(cas k compare swap)
(cas server k compare swap)
Compare and swap
Compare and swap
(close-fn rpc-chan this-server)
Close function cleans up local state.
Close function cleans up local state.
(dump-state server)
Dumps our full state machine state for given server
Dumps our full state machine state for given server
(get-leader)
(get-leader server)
Returns leader according to specified server.
Returns leader according to specified server.
(launch-raft-system instances)
Launches supplied number of raft instances. Stores their state and other data in the 'system' var that can be used to poke around, inquire about state, etc.
Launches supplied number of raft instances. Stores their state and other data in the 'system' var that can be used to poke around, inquire about state, etc.
(monitor-incoming-rcp event-chan rpc-chan this-server)
Receives incoming commands from external servers. In this case rpc-chan is called directly, but could originate from a tcp socket, websocket, etc.
Receives incoming commands from external servers. In this case rpc-chan is called directly, but could originate from a tcp socket, websocket, etc.
(random-server system)
Picks a random server in the raft system.
Picks a random server in the raft system.
(read k)
(read server k)
Reads from leader after all pending commands are committed.
Reads from leader after all pending commands are committed.
(read-local k)
(read-local server k)
Reads key from local state, doesn't sync across raft
Reads key from local state, doesn't sync across raft
(rpc-async server entry)
Performs rpc call to specified server, returns core async channel.
Performs rpc call to specified server, returns core async channel.
(rpc-sync server entry)
Performs a synchronous rpc call to specified server.
Performs a synchronous rpc call to specified server.
(send-rpc raft server operation data callback)
Sends rpc call to specified server. Includes a resp-chan that will eventually contain a response.
Sends rpc call to specified server. Includes a resp-chan that will eventually contain a response.
(snapshot-installer path)
Installs a new snapshot being sent from a different server. Blocking until write succeeds. An error will stop RAFT entirely.
If snapshot-part = 1, should first delete any existing file if it exists (possible to have historic partial snapshot lingering).
As soon as final part write succeeds, can safely garbage collect any old snapshots on disk except the most recent one.
Installs a new snapshot being sent from a different server. Blocking until write succeeds. An error will stop RAFT entirely. If snapshot-part = 1, should first delete any existing file if it exists (possible to have historic partial snapshot lingering). As soon as final part write succeeds, can safely garbage collect any old snapshots on disk except the most recent one.
(snapshot-list-indexes path)
Lists all stored snapshot indexes, sorted ascending. Used for bootstrapping a raft network from a previously made snapshot.
Lists all stored snapshot indexes, sorted ascending. Used for bootstrapping a raft network from a previously made snapshot.
(snapshot-reify path state-atom)
Reifies a snapshot, should populate whatever data is needed into an initialized state machine that is used for raft.
Called with snapshot-id to reify, which corresponds to the commit index the snapshot was taken. Should throw if snapshot not found, or unable to parse. This will stop raft.
Reifies a snapshot, should populate whatever data is needed into an initialized state machine that is used for raft. Called with snapshot-id to reify, which corresponds to the commit index the snapshot was taken. Should throw if snapshot not found, or unable to parse. This will stop raft.
(snapshot-writer path state-atom)
Blocking until write succeeds. An error will stop RAFT entirely.
Blocking until write succeeds. An error will stop RAFT entirely.
(snapshot-xfer path)
Transfers snapshot from this server as leader, to a follower. Will be called with two arguments, snapshot id and part number. Initial call will be for part 1, and subsequent calls, if necessary, will be for each successive part.
Must return a snapshot with the following fields :parts - how many parts total :data - snapshot data
If multiple parts are returned, additional requests for each part will be requested. A snapshot should be broken into multiple parts if it is larger than the amount of data you want to push across the network at once.
Transfers snapshot from this server as leader, to a follower. Will be called with two arguments, snapshot id and part number. Initial call will be for part 1, and subsequent calls, if necessary, will be for each successive part. Must return a snapshot with the following fields :parts - how many parts total :data - snapshot data If multiple parts are returned, additional requests for each part will be requested. A snapshot should be broken into multiple parts if it is larger than the amount of data you want to push across the network at once.
(start-instance servers server-id)
(state-machine state-atom)
Basic key-val store.
Operations are tuples that look like: [operation key val compare-val]
Operations supported are:
Basic key-val store. Operations are tuples that look like: [operation key val compare-val] Operations supported are: - :write - Writes a new value to specified key. Returns true on success. i.e. [:write 'mykey' 42] - :read - Reads value of provided key. Returns nil if value doesn't exist. i.e. [:read 'mykey'] - :delete - Deletes value at specified key. Returns true if successful, or false if key doesn't exist. i.e. [:delete 'mykey'] - :cas - Compare and swap. Compare current value of key with v and if equal, swap val to cas-v. Returns true on success and false on failure. i.e. [:cas 'mykey' 100 42] - swaps 'mykey' to 42 if current val is 100.
(view-raft-state server)
(view-raft-state server callback)
Displays current raft state for specified server.
Displays current raft state for specified server.
(write k v)
(write server k v)
Writes value to specified key.
Writes value to specified key.
(write-async k v)
(write-async server k v)
Writes value to specified key, returns core async chan with eventual response.
Writes value to specified key, returns core async chan with eventual response.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close