-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add transactions to file writes and restore files to previous state when transactions fail #100
Conversation
@xxfast Thanks for the fix any update on this when it was going to be in production thanks. |
Hi @SultanArshad planning this for 0.9.0 release. Stay tuned |
…nsactions # Conflicts: # kstore-file/src/commonMain/kotlin/io/github/xxfast/kstore/file/FileCodec.kt # kstore-file/src/commonMain/kotlin/io/github/xxfast/kstore/file/KStore.kt # kstore-file/src/commonTest/kotlin/io/github/xxfast/kstore/file/FileCodecTests.kt
Hi @SultanArshad This is ready for review :) |
Code Coverage
|
val actual: List<Pet>? = codec.decode() | ||
assertEquals(listOf(MYLO), actual) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @xxfast! I’m wondering what happens if a race condition occurs and two different agents/threads start writing to a file at the same time, but one of them gets canceled or stopped. Does this revert the file back to an older version that was not modified? What happens to the version of the file being updated by the other agent/thread?
I suggest there should be a way to check if someone is modifying the file, and the other process should have to wait or be queued until the current modification is finished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should really be a single store for a single file, but if there's an external process that is writing to the same file - and if the store write was cancelled, it should delete the temp file and leave the original file untouched
Addresses #91