Thread-safe Buffer.__items__; proper KeysView, ItemsView, ValuesView#93
Conversation
hendrikmakait
left a comment
There was a problem hiding this comment.
I have two questions regarding the implementation and a few nits.
| close(self.fast, self.slow) | ||
|
|
||
|
|
||
| class BufferItemsView(ItemsView[KT, VT]): |
There was a problem hiding this comment.
Should we also override __contains__ in BufferItemsView to avoid changing the LRU?
There was a problem hiding this comment.
The reason why __iter__ avoids changing the LRU is because it would raise RuntimeError halfway through. If you're testing if your buffer contains a specific key/value pair, and that causes the value to be unevicted from slow, then I don't see why it should bypass the principle of temporal locality.
There was a problem hiding this comment.
Thanks for the explanation; now it makes sense to me. I had assumed we wanted this to be a general property of the views.
If you're testing if your buffer contains a specific key/value pair, and that causes the value to be unevicted from slow, then I don't see why it should bypass the principle of temporal locality.
Sounds good to me!
Co-authored-by: Hendrik Makait <hendrik@makait.com>
Co-authored-by: Hendrik Makait <hendrik@makait.com>
|
@hendrikmakait all review comments have been addressed |
distributed.worker_state_machine.WorkerStateMachine.validate_state(), while another is evicting/restoring a key