proxygen
folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator Class Reference

#include <ConcurrentHashMap.h>

Public Member Functions

const value_typeoperator* () const
 
const value_typeoperator-> () const
 
ConstIteratoroperator++ ()
 
bool operator== (const ConstIterator &o) const
 
bool operator!= (const ConstIterator &o) const
 
ConstIteratoroperator= (const ConstIterator &o)=delete
 
ConstIteratoroperator= (ConstIterator &&o) noexcept
 
 ConstIterator (const ConstIterator &o)=delete
 
 ConstIterator (ConstIterator &&o) noexcept
 
 ConstIterator (const ConcurrentHashMap *parent, uint64_t segment)
 

Private Member Functions

 ConstIterator (const ConcurrentHashMap *parent)
 
 ConstIterator (uint64_t shards)
 
void next ()
 

Private Attributes

SegmentT::Iterator it_
 
uint64_t segment_
 
const ConcurrentHashMapparent_
 

Friends

class ConcurrentHashMap
 

Detailed Description

template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
class folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator

Definition at line 395 of file ConcurrentHashMap.h.

Constructor & Destructor Documentation

template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::ConstIterator ( const ConstIterator o)
delete
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::ConstIterator ( ConstIterator &&  o)
inlinenoexcept

Definition at line 434 of file ConcurrentHashMap.h.

435  : it_(std::move(o.it_)),
436  segment_(std::exchange(o.segment_, uint64_t(NumShards))),
437  parent_(std::exchange(o.parent_, nullptr)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
static constexpr uint64_t NumShards
T exchange(T &obj, U &&new_value)
Definition: Utility.h:120
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::ConstIterator ( const ConcurrentHashMap parent,
uint64_t  segment 
)
inline

Definition at line 439 of file ConcurrentHashMap.h.

440  : segment_(segment), parent_(parent) {}
folly::Function< void()> parent
Definition: AtFork.cpp:34
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::ConstIterator ( const ConcurrentHashMap parent)
inlineexplicitprivate

Definition at line 444 of file ConcurrentHashMap.h.

References folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::next().

445  : it_(parent->ensureSegment(0)->cbegin()),
446  segment_(0),
447  parent_(parent) {
448  // Always iterate to the first element, could be in any shard.
449  next();
450  }
folly::Function< void()> parent
Definition: AtFork.cpp:34
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::ConstIterator ( uint64_t  shards)
inlineexplicitprivate

Definition at line 453 of file ConcurrentHashMap.h.

Member Function Documentation

template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
void folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::next ( )
inlineprivate

Definition at line 455 of file ConcurrentHashMap.h.

References folly::detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex >::cend(), folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ensureSegment(), folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::it_, folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::NumShards, folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::parent_, folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::segment_, and folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::segments_.

Referenced by folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::ConstIterator(), folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::erase(), and folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::operator++().

455  {
456  while (it_ == parent_->ensureSegment(segment_)->cend() &&
458  SegmentT* seg{nullptr};
459  while (!seg) {
460  segment_++;
461  seg = parent_->segments_[segment_].load(std::memory_order_acquire);
462  if (segment_ < parent_->NumShards) {
463  if (!seg) {
464  continue;
465  }
466  it_ = seg->cbegin();
467  }
468  break;
469  }
470  }
471  }
SegmentT * ensureSegment(uint64_t i) const
static constexpr uint64_t NumShards
Atom< SegmentT * > segments_[NumShards]
detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex > SegmentT
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
bool folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::operator!= ( const ConstIterator o) const
inline
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
const value_type& folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::operator* ( ) const
inline
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
ConstIterator& folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::operator++ ( )
inline
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
const value_type* folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::operator-> ( ) const
inline
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
ConstIterator& folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::operator= ( const ConstIterator o)
delete
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
ConstIterator& folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::operator= ( ConstIterator &&  o)
inlinenoexcept
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
bool folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::operator== ( const ConstIterator o) const
inline

Friends And Related Function Documentation

template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
friend class ConcurrentHashMap
friend

Definition at line 397 of file ConcurrentHashMap.h.

Member Data Documentation

template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
SegmentT::Iterator folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::it_
private
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
const ConcurrentHashMap* folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::parent_
private
template<typename KeyType, typename ValueType, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, uint8_t ShardBits = 8, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
uint64_t folly::ConcurrentHashMap< KeyType, ValueType, HashFn, KeyEqual, Allocator, ShardBits, Atom, Mutex >::ConstIterator::segment_
private

The documentation for this class was generated from the following file: