Skip to content

Improve LockContention ergonomics and move lifecycle init outside shard lock#114

Closed
fsdvh wants to merge 5 commits into
arthurprs:masterfrom
fsdvh:small-update
Closed

Improve LockContention ergonomics and move lifecycle init outside shard lock#114
fsdvh wants to merge 5 commits into
arthurprs:masterfrom
fsdvh:small-update

Conversation

@fsdvh
Copy link
Copy Markdown
Contributor

@fsdvh fsdvh commented Apr 29, 2026

Summary

  • LockContention ergonomics: Added Clone, Copy, PartialEq, Eq, Hash derives so the error type can be compared, stored in sets/maps, and used in more contexts without surprise.
  • Performance fix in try_insert_with_lifecycle: Moved lifecycle.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.
  • Doc improvements: Clarified that lock contention is the only failure mode for try_insert / try_insert_with_lifecycle, and that inputs are returned so callers can retry or discard without data loss.

Test plan

  • Existing tests pass (cargo test)
  • test_try_insert and test_try_insert_with_lifecycle cover the non-blocking insert paths

🤖 Generated with Claude Code

fsdvh and others added 5 commits April 13, 2026 10:39
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>
@fsdvh fsdvh closed this Apr 29, 2026
@fsdvh fsdvh deleted the small-update branch April 29, 2026 08:54
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.

1 participant