https://github.com/halfzebra/rust-transaction-engine
🔄 Simple transaction engine as a CLI written in Rust
https://github.com/halfzebra/rust-transaction-engine
Last synced: 2 months ago
JSON representation
🔄 Simple transaction engine as a CLI written in Rust
- Host: GitHub
- URL: https://github.com/halfzebra/rust-transaction-engine
- Owner: halfzebra
- Created: 2022-05-30T09:37:10.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-02T19:02:15.000Z (about 4 years ago)
- Last Synced: 2025-01-20T10:14:04.170Z (over 1 year ago)
- Language: Rust
- Homepage:
- Size: 23.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🔄 rust-transaction-engine
## Usage
```bash
cargo run -- examples/basic.csv
# to output into accounts.csv file
cargo run -- examples/basic.csv > accounts.csv
```
## Possible optimisations
Streaming the CSV is a bit pointless, since we are doing stateful event stream processing.
This means that we actually need to access transactions retrospectively, so storing them in an indexed format in some persisted storage is a must.
As an option for storage we could use SQLite or other embedded KV solutions, in a real project it's probably better to use a DB.
## Assumptions
- It's only possible to `Dispute` the `Withdrawal` and `Deposit`
- It's impossible to `Withdraw` negative amount
- It's impossible to `Deposit` negative amount
- `Withdraw`al of larger sum, than available does not process and is ignored
- Locked account does not respond to any further transactions