input-output-hk / mithril

Stake-based threshold multi-signatures protocol
https://mithril.network
Apache License 2.0
115 stars 36 forks source link

Sqlite auto rollback #1742

Closed Alenar closed 3 weeks ago

Alenar commented 3 weeks ago

Content

This PR add a light layer to easily open, commit, and rollback SQLite transactions.

This is done by adding a Transaction struct to mithril-persistence that:

Also a begin_transaction extension method is added to the sqlite transaction so they can be created without needing to import the new type.

Pre-submit checklist

Comments

While this system make using SQLite transactions easier it should not be used on our main SQLite database until we implement a connection pool system instead of sharing a global connection. Else we would be at risk of opening a transaction when one was already opened leading to at minimum an error or at worst a crash.

Issue(s)

Closes #1741

github-actions[bot] commented 3 weeks ago

Test Results

    3 files  ±0     43 suites  ±0   8m 35s :stopwatch: +8s 1 035 tests +6  1 035 :white_check_mark: +6  0 :zzz: ±0  0 :x: ±0  1 133 runs  +6  1 133 :white_check_mark: +6  0 :zzz: ±0  0 :x: ±0 

Results for commit 12576161. ± Comparison against base commit f5097f0a.

:recycle: This comment has been updated with latest results.