Storage Engine API
mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All Class Reference

Used to protect access to all partitions of this partitioned associative structure. More...

#include <partitioned.h>

Detailed Description

template<typename AssociativeContainer, std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
class mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All

Used to protect access to all partitions of this partitioned associative structure.

For example, may be used to empty each partition in the structure, or to provide a snapshotted count of the number of entries across all partitions.

Public Member Functions

auto begin () &
 Returns an iterator at the start of the partitions. More...
 
auto end () &
 Returns an iterator at the end of the partitions. More...
 
auto begin () const &
 Returns an iterator at the start of the partitions. More...
 
void begin () &&=delete
 
auto end () const &
 Returns an iterator at the end of the partitions. More...
 
void end () &&=delete
 
std::size_t size () const
 Returns the number of elements in all partitions, summed together. More...
 
bool empty () const
 Returns true if each partition is empty. More...
 
std::size_t count (const key_type &key) const
 Returns the number of entries with the given key. More...
 
void clear ()
 Empties each container within each partition. More...
 
void insert (value_type value) &
 Inserts value into its designated partition. More...
 
void insert (value_type) &&=delete
 
std::size_t erase (const key_type &key) &
 Erases one entry from the partitioned structure, returns the number of entries removed. More...
 
void erase (const key_type &) &&=delete
 

Private Member Functions

 All (Partitioned &partitionedContainer)
 Acquires locks for all partitions. More...
 

Private Attributes

std::vector< stdx::unique_lock< stdx::mutex > > _lockGuards
 
Partitioned_partitionedContainer
 

Friends

class Partitioned
 

Constructor & Destructor Documentation

◆ All()

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::All ( Partitioned partitionedContainer)
inlineexplicitprivate

Acquires locks for all partitions.

The lifetime of this All object must be shorter than that of partitionedContainer.

Member Function Documentation

◆ begin() [1/3]

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
auto mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::begin ( ) &
inline

Returns an iterator at the start of the partitions.

◆ begin() [2/3]

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
auto mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::begin ( ) const &
inline

Returns an iterator at the start of the partitions.

◆ begin() [3/3]

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
void mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::begin ( ) &&
delete

◆ clear()

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
void mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::clear ( )
inline

Empties each container within each partition.

◆ count()

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
std::size_t mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::count ( const key_type key) const
inline

Returns the number of entries with the given key.

◆ empty()

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
bool mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::empty ( ) const
inline

Returns true if each partition is empty.

◆ end() [1/3]

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
auto mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::end ( ) &
inline

Returns an iterator at the end of the partitions.

◆ end() [2/3]

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
auto mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::end ( ) const &
inline

Returns an iterator at the end of the partitions.

◆ end() [3/3]

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
void mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::end ( ) &&
delete

◆ erase() [1/2]

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
std::size_t mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::erase ( const key_type key) &
inline

Erases one entry from the partitioned structure, returns the number of entries removed.

◆ erase() [2/2]

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
void mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::erase ( const key_type ) &&
delete

◆ insert() [1/2]

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
void mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::insert ( value_type  value) &
inline

Inserts value into its designated partition.

◆ insert() [2/2]

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
void mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::insert ( value_type  ) &&
delete

◆ size()

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
std::size_t mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::size ( ) const
inline

Returns the number of elements in all partitions, summed together.

Friends And Related Function Documentation

◆ Partitioned

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
friend class Partitioned
friend

Member Data Documentation

◆ _lockGuards

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
std::vector<stdx::unique_lock<stdx::mutex> > mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::_lockGuards
private

◆ _partitionedContainer

template<typename AssociativeContainer , std::size_t nPartitions = 16, typename KeyPartitioner = Partitioner<typename AssociativeContainer::key_type>>
Partitioned* mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::All::_partitionedContainer
private

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