| @ref bit_packed_atomic_flags implements
| a container for garbage collection
| flags that is only thread unsafe on calls
| to setup. This class bit-packs collection
| flags for memory efficiency.
|
| All operations are std::memory_order_relaxed
| so external mechanisms must ensure
| that writes and reads are properly synchronized.
|
| On setup(n), all bits up to n are marked
| as collected.
|
| Under the hood, because it is an 8-bit
| type, it makes sense to use a multiple
| of 8 for setup, but it will be safe if that
| is not the case as well.
|
| No default constructor, as there must
| be some size.
|
| @ref cache implements a cache with
| properties similar to a cuckoo-set.
|
| The cache is able to hold up to
| (~(uint32_t)0) - 1 elements.
|
| Read Operations:
| - contains() for erase=false
|
| Read+Erase Operations:
| - contains() for erase=true
|
| Erase Operations:
| - allow_erase()
|
| Write Operations:
| - setup()
| - setup_bytes()
| - insert()
| - please_keep()
|
| Synchronization Free Operations:
| - invalid()
| - compute_hashes()
|
| User Must Guarantee:
|
| -1. Write requires synchronized access
| (e.g. a lock)
|
| -2. Read requires no concurrent Write,
| synchronized with last insert.
|
| -3. Erase requires no concurrent Write,
| synchronized with last insert.
|
| -4. An Erase caller must release all memory
| before allowing a new Writer.
|
| Note on function names:
|
| - The name “allow_erase” is used because
| the real discard happens later.
|
| - The name “please_keep” is used because
| elements may be erased anyways on insert.
|
| @tparam Element should be a movable and
| copyable type
|
| @tparam Hash should be a function/callable
| which takes a template parameter
|
| hash_select and an Element and extracts
| a hash from it. Should return high-entropy
| uint32_t hashes for Hash h; h<0>(e) | ... h<7>(e).