xxfast / KStore

A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisation and kotlinx.io
https://xxfast.github.io/KStore/
Apache License 2.0
542 stars 18 forks source link

Implement file writes as transactions and can restore to previous state when the transactions fail #91

Closed xxfast closed 1 month ago

xxfast commented 8 months ago

kstore-file can store malformed json data in a file if a coroutine is cancelled mid-write and cause a JsonDecodingException when attemping to read this value back.

In such instances - we should be be restoring the file back to the previous known valid state and handle store updates as transactions

xxfast commented 1 month ago

Done ✅ available on 0.9.0-SNAPSHOT