Abstraction of the place where generation locks are stored.
The trait is unsafe because if the trait messes up with the values stored in there in any way (or makes the values available to something else that messes them up), this can cause UB and daemons and discomfort to users and such. The library expects it is the only one storing values there. In other words, it is expected the trait is only a dumb storage and doesn't actively do anything.
The type for keeping several shards.
In general, it is expected to be a fixed-size array, but different implementations can have different sizes.
fn gen_idx(&self) -> &AtomicUsize
Access to the generation index.
Must return the same instance of the
AtomicUsize for the lifetime of the storage, must
0 and the trait itself must not modify it. Must be async-signal-safe.
Access to the shards storage.
Must return the same instance of the shards for the lifetime of the storage. Must start zeroed-out and the trait itself must not modify it.
fn choose_shard(&self) -> usize
Pick one shard of the all selected.
Returns the index of one of the shards. The choice can be arbitrary, but it should be fast and avoid collisions.