Skip to content

Give each codec its own staging file - #174

Merged
xxfast merged 5 commits into
masterfrom
ir/multiple-stores-one-file
Aug 7, 2026
Merged

Give each codec its own staging file#174
xxfast merged 5 commits into
masterfrom
ir/multiple-stores-one-file

Conversation

@xxfast

@xxfast xxfast commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Supersedes #154, same issue (#85).

Two stores on one file share a staging path ($file.temp), so concurrent writes can interleave into one buffer. Each codec now stages through its own, so the move stays atomic and the worst case is last write wins.

#154 deduplicated stores in a global registry instead. That changes what storeOf means, and can't be keyed reliably since SystemFileSystem.resolve throws when the file doesn't exist yet, which is exactly the case at storeOf time.

Not a confirmed cause of #80, #157 or #162, those look more like #175. Sync half of #85 is still #124.

Kept @Khudoyshukur's commit.

  • Reuse KStore instance if the same codec is provided
  • Refactor FileCodec to use unique temporary files for staging and simplify store creation

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.35%. Comparing base (fdc1b10) to head (b62faf9).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #174      +/-   ##
==========================================
+ Coverage   94.26%   94.35%   +0.09%     
==========================================
  Files           8        8              
  Lines         122      124       +2     
  Branches       11       11              
==========================================
+ Hits          115      117       +2     
  Partials        7        7              
Files with missing lines Coverage Δ
...n/kotlin/io/github/xxfast/kstore/file/FileCodec.kt 100.00% <100.00%> (ø)
...b/xxfast/kstore/file/extensions/KVersionedStore.kt 100.00% <100.00%> (ø)

@xxfast
xxfast marked this pull request as ready for review August 4, 2026 20:15
@xxfast
xxfast merged commit 2e95c8b into master Aug 7, 2026
8 checks passed
@xxfast
xxfast deleted the ir/multiple-stores-one-file branch August 7, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants