Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 1.28 KB

README.md

File metadata and controls

36 lines (30 loc) · 1.28 KB

Leviathan

Simple toy payments engine that reads a series of transactions from a CSV, updates client accounts, handles disputes and chargebacks, and then outputs the state of accounts as a CSV.

Installation

git clone [email protected]:lfordyce/leviathan.git

Execution

cargo run -- transactions.csv > accounts.csv
  • Alternatively run in release mode:
cargo run --release -- transactions.csv >accounts.csv

Error Handling

  • When an illegal action occurs, for example a transaction attempting to withdrawal more funds than available, the transaction will not be applied to the account and errors will output to stderr.
  • To capture account balances and errors separately, run the following:
cargo run -- 2> error.log 1> accounts.csv

Testing

  • Run unit tests
cargo test

Highlights

  • Generic and Modular. Functional design along with the Rust typesystem, Leviathan could be configured to listen on a TCP Stream for transaction events. (currently setup to only read events from a csv file)
  • Functional reactive design. Utilizing the Tokio runtime, the Leviathan engine asynchronously streams in transaction events to update an internal account ledger.