Skip to content
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

Don't use callback and Guard with a RwLock the Value inside Entry #63

Merged
merged 7 commits into from
Jan 24, 2024

Conversation

crodas
Copy link
Owner

@crodas crodas commented Jan 23, 2024

Instead return a reference to the Guarded HashMap and a reference to the Key to be read

@crodas crodas self-assigned this Jan 23, 2024
@crodas crodas force-pushed the no-db-callback branch 4 times, most recently from 97853c6 to e4079f5 Compare January 23, 2024 17:50
Instead return a reference to the Guarded HashMap and a reference to the
Key to be read.

Also update Entry to not need a mutable instance ever. Use an internal
mutex for the expiration and atomic for the object ids.

Do not use time for the object ids, use an atomic counter instead
@crodas crodas force-pushed the no-db-callback branch 2 times, most recently from fc5dfd2 to e037099 Compare January 23, 2024 23:06
@crodas crodas changed the title Do not use callbacks Don' Jan 23, 2024
@crodas crodas changed the title Don' Don't use callback and Guard with a RwLock the Value inside Entry Jan 23, 2024
The main goal is to avoid locking the entire slot as Write() to update
 a single value. Slots should be locked as write to add/remove new keys,
 not for individual updates. That's suboptimal.

 A requirement for that is to guard the Value with a RwLock
Non scalar values have a proper locking mechanism inside an Entry, that
is enough to drop the former `shared` wrapper.
@crodas crodas marked this pull request as ready for review January 24, 2024 20:42
@crodas crodas merged commit ca96197 into main Jan 24, 2024
3 checks passed
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