ATLAS Offline Software
Loading...
Searching...
No Matches
ConcurrentHashmapImpl.h File Reference

Hash table allowing concurrent, lockless reads. More...

#include "CxxUtils/atomic_fetch_minmax.h"
#include "CxxUtils/concepts.h"
#include <functional>
#include <cstdint>
#include <cstdlib>
#include <atomic>
#include <mutex>
#include <memory>
#include <new>
#include "CxxUtils/ConcurrentHashmapImpl.icc"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CxxUtils::detail::HashmapLock
 Helper to allow for external locking with put(). More...
struct  CxxUtils::detail::CHMTableIterator< ENTRIES_PER_CACHELINE >
 Helper to generate hash probes. More...
class  CxxUtils::detail::Table
 Hash table allowing concurrent, lockless reads. More...
class  CxxUtils::detail::const_iterator
 Bidirectional iterator over occupied table entries. More...

Namespaces

namespace  CxxUtils
namespace  CxxUtils::detail

Concepts

concept  CxxUtils::detail::IsConcurrentHashmapPayload
 Concept for a value that can be saved in a concurrent hash map.

Typedefs

using CxxUtils::detail::ConcurrentHashmapVal_t = uintptr_t
 Type used for keys and values — an unsigned big enough to hold a pointer.
using CxxUtils::detail::Updater_t = UPDATER_<Table>
using CxxUtils::detail::Context_t = typename Updater_t::Context_t
using CxxUtils::detail::const_iterator_range = std::pair<const_iterator, const_iterator>

Functions

 CxxUtils::detail::ConcurrentHashmapImpl (Updater_t &&updater, size_t capacity_in, const Hasher_t &hasher, const Matcher_t &matcher, const typename Updater_t::Context_t &ctx)
 Constructor.
 CxxUtils::detail::ConcurrentHashmapImpl (const ConcurrentHashmapImpl &)=delete
ConcurrentHashmapImplCxxUtils::detail::operator= (const ConcurrentHashmapImpl &)=delete
size_t CxxUtils::detail::size () const
 Return the number of items currently stored.
size_t CxxUtils::detail::capacity () const
 Return the current table size.
size_t CxxUtils::detail::erased () const
 The number of erased elements in the current table.
const Hasher_t & CxxUtils::detail::hasher () const
 Return the hasher object.
const Matcher_t & CxxUtils::detail::matcher () const
 Return the matcher object.
Lock_t CxxUtils::detail::lock ()
 Take a lock on the container.
std::pair< const_iterator, bool > CxxUtils::detail::put (val_t key, size_t hash, val_t val, bool overwrite, const typename Updater_t::Context_t &ctx)
 Add an entry to the table.
std::pair< const_iterator, bool > CxxUtils::detail::put (const Lock_t &lock, val_t key, size_t hash, val_t val, bool overwrite, const typename Updater_t::Context_t &ctx)
 Add an entry to the table, with external locking.
const_iterator CxxUtils::detail::get (val_t key, size_t hash) const
 Look up an entry in the table.
bool CxxUtils::detail::erase (val_t key, size_t hash)
 Erase an entry from the table.
bool CxxUtils::detail::erase (const Lock_t &lock, val_t key, size_t hash)
 Erase an entry from the table, with external locking.
const_iterator_range CxxUtils::detail::range () const
 Return a range that can be used to iterate over the container.
const_iterator CxxUtils::detail::begin () const
 A begin iterator for the container.
const_iterator CxxUtils::detail::end () const
 An end iterator for the container.
const_iterator CxxUtils::detail::clear (size_t capacity, const typename Updater_t::Context_t &ctx)
 Erase the table and change the capacity.
const_iterator CxxUtils::detail::clear (const typename Updater_t::Context_t &ctx)
 Erase the table (don't change the capacity).
void CxxUtils::detail::forceClear ()
 Erase the table by filling it with nulls.
void CxxUtils::detail::reserve (size_t capacity, const typename Updater_t::Context_t &ctx)
 Increase the table capacity.
void CxxUtils::detail::quiescent (const typename Updater_t::Context_t &ctx)
 Called when this thread is no longer referencing anything from this container.
void CxxUtils::detail::swap (ConcurrentHashmapImpl &other)
 Swap this container with another.
Updater_tCxxUtils::detail::updater ()
 Access the Updater instance.
bool CxxUtils::detail::grow (const Lock_t &lock, const typename Updater_t::Context_t &ctx)
 Make the table larger.
bool CxxUtils::detail::grow (const Lock_t &lock, size_t new_capacity, const typename Updater_t::Context_t &ctx)
 Make the table larger.
static uint64_t CxxUtils::detail::round_up (uint64_t)

Variables

*Updater object managing memory See above Updater_t CxxUtils::detail::m_updater
*The hash object const Hasher_t CxxUtils::detail::m_hasher
*The key match object const Matcher_t CxxUtils::detail::m_matcher
*The current table instance Must be holding the mutex to access this TableCxxUtils::detail::m_table
*Number of entries in the map std::atomic< size_t > CxxUtils::detail::m_size
*Number of entries that have been erased std::atomic< size_t > CxxUtils::detail::m_erased
*Mutex to serialize changes to the map std::mutex CxxUtils::detail::m_mutex

Detailed Description

Hash table allowing concurrent, lockless reads.

Author
scott snyder snyde.nosp@m.r@bn.nosp@m.l.gov
Date
Dec, 2020

Definition in file ConcurrentHashmapImpl.h.