cargo run -- INPUT
or
./toy-payments-engine INPUT
where INPUT
is the path to the CSV file with input.
Can be run by cargo test
. They are divided in 3 groups:
- Unit tests - defined in respective modules.
- Functional tests - defined in
tests/functional.rs
- test the whole application with prepared data sets. - User Interaction - defined in
tests/ui.rs
- test the "unhappy path" feedback for the user.
- The input csv is processed one-row-at-a-time. This is to prevent excessive memory usage on big input sets.
- The type used to handle the transaction amounts is
f64
. In real application, probably something custom, less prone to rounding errors, should be used. - Only deposit transactions can be disputed.
- "Locked" clients can not accept deposits nor withdrawals. They can, however, accept new disputes, resolves and chargebacks.
- The current implementation of
Repository
is not very multithread-friendly nor optimized, but it can be easily modified to be so by modifyingclients
field to be of typeHashMap<u16, Mutex<Client>>
, aquiring the lock inregister_transaction
method, and sharing theRepository
object between threads via anArc
. This way we can aquire Mutex locks per client instead of on whole repository.