Liking cljdoc? Tell your friends :D

fluree.raft.kv-example


casclj

(cas k compare swap)
(cas server k compare swap)

Compare and swap

Compare and swap
raw docstring

closeclj

(close system server)

Closes specified server.

Closes specified server.
raw docstring

close-fnclj

(close-fn rpc-chan this-server)

Close function cleans up local state.

Close function cleans up local state.
raw docstring

deleteclj

(delete k)
(delete server k)

Delete key

Delete key
raw docstring

dump-stateclj

(dump-state server)

Dumps our full state machine state for given server

Dumps our full state machine state for given server
raw docstring

get-leaderclj

(get-leader)
(get-leader server)

Returns leader according to specified server.

Returns leader according to specified server.
raw docstring

launch-raft-systemclj

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

monitor-incoming-rcpclj

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

random-serverclj

(random-server system)

Picks a random server in the raft system.

Picks a random server in the raft system.
raw docstring

readclj

(read k)
(read server k)

Reads from leader after all pending commands are committed.

Reads from leader after all pending commands are committed.
raw docstring

read-localclj

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

rpc-asyncclj

(rpc-async server entry)

Performs rpc call to specified server, returns core async channel.

Performs  rpc call to specified server, returns core async channel.
raw docstring

rpc-syncclj

(rpc-sync server entry)

Performs a synchronous rpc call to specified server.

Performs a synchronous rpc call to specified server.
raw docstring

send-rpcclj

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

snapshot-installerclj

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

snapshot-list-indexesclj

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

snapshot-reifyclj

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

snapshot-writerclj

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

snapshot-xferclj

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

start-instanceclj

(start-instance servers server-id)

state-machineclj

(state-machine state-atom)

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

systemclj


view-raft-stateclj

(view-raft-state server)
(view-raft-state server callback)

Displays current raft state for specified server.

Displays current raft state for specified server.
raw docstring

writeclj

(write k v)
(write server k v)

Writes value to specified key.

Writes value to specified key.
raw docstring

write-asyncclj

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

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

× close