Trait arc_swap::gen_lock::LockStorage [−][src]
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.
Associated Types
type Shards: AsRef<[Shard]>
[src]
The type for keeping several shards.
In general, it is expected to be a fixed-size array, but different implementations can have different sizes.
Required methods
fn gen_idx(&self) -> &AtomicUsize
[src]
Access to the generation index.
Must return the same instance of the AtomicUsize
for the lifetime of the storage, must
start at 0
and the trait itself must not modify it. Must be async-signal-safe.
fn shards(&self) -> &Self::Shards
[src]
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
[src]
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.