Improve LockContention ergonomics and move lifecycle init outside shard lock#114
Closed
fsdvh wants to merge 5 commits into
Closed
Improve LockContention ergonomics and move lifecycle init outside shard lock#114fsdvh wants to merge 5 commits into
fsdvh wants to merge 5 commits into
Conversation
Add non-blocking API for sync cache
Expose shard_index method
* Add non-blocking methods * Do not leak lcs * Dedicated result * More * Simplify * Cleanup + some docs * Docs * Use a feature flag * Posion lock * Remove feature and more tests * Update src/sync.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Simplify signature * Simplify * clippy * More docs * Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/sync.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * AI suggestions * Update src/sync.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LockContentionergonomics: AddedClone, Copy, PartialEq, Eq, Hashderives so the error type can be compared, stored in sets/maps, and used in more contexts without surprise.try_insert_with_lifecycle: Movedlifecycle.begin_request()to before the shard lock is acquired. Previously the lifecycle was initialized while holding the write lock; moving it outside avoids blocking other operations on the same shard during potentially expensive lifecycle setup.try_insert/try_insert_with_lifecycle, and that inputs are returned so callers can retry or discard without data loss.Test plan
cargo test)test_try_insertandtest_try_insert_with_lifecyclecover the non-blocking insert paths🤖 Generated with Claude Code