hawkw / sharded-slab

a lock-free concurrent slab (experimental)
MIT License
269 stars 17 forks source link

Add support for mutable access #41

Closed hawkw closed 3 years ago

hawkw commented 4 years ago

This is still quite rough, needs docs, additional testing, and cleanup, but it basically works.

Signed-off-by: Eliza Weisman eliza@buoyant.io

bIgBV commented 4 years ago

Having gone through the changes I think you got the main parts all done. I've got one thought though. I think we can provide more granular error messages here. Now we have multiple failure conditions for why a get call fails:

As a user, I'd like to know which of these three cases caused the failure. I see that you already created a user facing error type GetMutError with a couple of errors, but I think we need to change methods on Slot to return a Result<T, SlotError> instead of an Option.

EDIT: Or we can rename GetMutError to StorageError and extend that to include the other cases and use it for all get* methods.

bIgBV commented 4 years ago

Besides that, I think it's mostly just tests and docs.

bIgBV commented 4 years ago

@hawkw Added tests for the slab impl and looks like you had already created tests for the pool impl. Also added documentation. I figured I could port the create API to return a get_mut guard in a separate PR.