https://github.com/pigeonhands/transaction-app
An application to process transactions from a CSV file written in rust
https://github.com/pigeonhands/transaction-app
Last synced: 4 months ago
JSON representation
An application to process transactions from a CSV file written in rust
- Host: GitHub
- URL: https://github.com/pigeonhands/transaction-app
- Owner: pigeonhands
- Created: 2022-09-02T09:45:21.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-27T23:14:44.000Z (over 2 years ago)
- Last Synced: 2025-01-12T18:11:16.721Z (5 months ago)
- Language: Rust
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Transaction app
This is a small app to process transactions in a csv file and print the result of the clients to stdout.
for example, with `transactions.csv`
```
type, client, tx, amount
deposit, 1, 1, 1.0
deposit, 2, 2, 2.0
deposit, 1, 3, 2.0
withdrawal, 1, 4, 1.5
withdrawal, 2, 5, 3.0
```will print
```
client,available,held,total,
1,1.5,0.0,1.5,false
2,2.0,0.0,2.0,false
```
to stdout.The transactions and client state are stored in memory so the same state will **NOT** be used across diffrent transaction csv files.
## Assumptions
---
1) The `client` in the `dispute`, `resolve` and `chargeback` transaction is the client performing the `dispute`
2) Locked accounts can not perform any action.## Larger transactions / Keeping state
-------Although the apps current usage does not benefit from `async`/`await` as it is taking transactions from a single io source, the `TransactionService` has been written in an `async` way as to possably be used with other io sources such as a tcp stream.
The application is using `sqlite` to process the transactions. For larger transaction files, another database such as `PostgreSQL` should be used.