The :bank workload: move money between accounts and check that none is
created or destroyed.
Generator, defaults and checker come from jepsen.tests.bank. This is the
only workload that requires multi-key atomic transactions: a transfer
debits one account and credits another, and a read that catches a target
halfway through sees a total that doesn't add up. A target without atomic
multi-key updates cannot meaningfully run :bank.
:init value is {account balance} -> set those balances. Sent once,
before any transfers, to open the accounts.
:transfer value is {:from a, :to b, :amount n} -> atomically debit
from and credit to. If the transfer is rejected -- say the
balance is too low -- call lite.client/fail!.
:read value is nil -> return a map of every account to its balance.
The workload chooses the accounts and the starting total, and seeds them
itself through the same handler as every other op -- the target starts empty
and knows nothing about banking. Reads must cover all the accounts, and
(unless :negative-balances?) balances may not go negative.
The `:bank` workload: move money between accounts and check that none is
created or destroyed.
Generator, defaults and checker come from `jepsen.tests.bank`. This is the
only workload that requires **multi-key atomic transactions**: a transfer
debits one account and credits another, and a read that catches a target
halfway through sees a total that doesn't add up. A target without atomic
multi-key updates cannot meaningfully run `:bank`.
## Handler contract
:init value is {account balance} -> set those balances. Sent once,
before any transfers, to open the accounts.
:transfer value is {:from a, :to b, :amount n} -> atomically debit
`from` and credit `to`. If the transfer is rejected -- say the
balance is too low -- call `lite.client/fail!`.
:read value is nil -> return a map of every account to its balance.
The workload chooses the accounts and the starting total, and seeds them
itself through the same handler as every other op -- the target starts empty
and knows nothing about banking. Reads must cover all the accounts, and
(unless `:negative-balances?`) balances may not go negative.(workload {:keys [op-limit negative-balances?]
:or {op-limit 200 negative-balances? false}})Options:
:op-limit Total ops (default 200), or false for as many as the run has time for. :negative-balances? If true, balances may go below zero (default false).
Options:
:op-limit Total ops (default 200), or false for as many as the
run has time for.
:negative-balances? If true, balances may go below zero (default false).cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |