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
470 stars 15 forks source link

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

Open xxfast opened 5 months ago

xxfast commented 5 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