Skip to content

lfordyce/leviathan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Toy payments engine written in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages