![]() |
Storage Engine API
|
A templated class used to partition an associative container like a set or a map to increase scalability. More...
#include <partitioned.h>
A templated class used to partition an associative container like a set or a map to increase scalability.
AssociativeContainer
is a type like a std::map or std::set that meets the requirements of either the AssociativeContainer or UnorderedAssociativeContainer concept. nPartitions
determines how many partitions to make. Partitioner
can be provided to customize how the partition of each entry is computed.
Classes | |
class | All |
Used to protect access to all partitions of this partitioned associative structure. More... | |
struct | IteratorEndTag |
class | OnePartition |
Used to protect access to a single partition of a Partitioned. More... | |
Public Types | |
using | value_type = typename AssociativeContainer::value_type |
using | key_type = typename AssociativeContainer::key_type |
using | PartitionId = std::size_t |
Public Member Functions | |
Partitioned () | |
Constructs a partitioned version of a AssociativeContainer, with nPartitions partitions. More... | |
Partitioned (const Partitioned &)=delete | |
Partitioned (Partitioned &&)=default | |
Partitioned & | operator= (const Partitioned &)=delete |
Partitioned & | operator= (Partitioned &&)=default |
~Partitioned ()=default | |
bool | empty () const |
Returns true if each partition is empty. More... | |
std::size_t | size () const |
Returns the number of elements in all partitions, summed together. More... | |
std::size_t | count (const key_type &key) & |
Returns the number of entries with the given key. More... | |
void | count (const key_type &) &&=delete |
void | clear () |
Empties all partitions. More... | |
void | insert (const value_type value) & |
Inserts a single value into the partitioned structure. More... | |
void | insert (const value_type) &&=delete |
std::size_t | erase (const key_type &key) & |
Erases one entry from the partitioned structure. More... | |
void | erase (const key_type &) &&=delete |
All | lockAllPartitions () & |
OnePartition | lockOnePartition (const key_type key) & |
OnePartition | lockOnePartitionById (PartitionId id) & |
Private Types | |
using | CacheAlignedAssociativeContainer = CacheAligned< AssociativeContainer > |
template<typename T > | |
using | AlignedVector = std::vector< T, boost::alignment::aligned_allocator< T > > |
Private Attributes | |
AlignedVector< partitioned_detail::CacheAlignedMutex > | _mutexes |
AlignedVector< CacheAlignedAssociativeContainer > | _partitions |
|
private |
|
private |
using mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::key_type = typename AssociativeContainer::key_type |
using mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::PartitionId = std::size_t |
using mongo::Partitioned< AssociativeContainer, nPartitions, KeyPartitioner >::value_type = typename AssociativeContainer::value_type |
|
inline |
Constructs a partitioned version of a AssociativeContainer, with nPartitions
partitions.
|
delete |
|
default |
|
default |
|
inline |
Empties all partitions.
|
inline |
Returns the number of entries with the given key.
Acquires locks for only the partition determined by that key.
|
delete |
|
inline |
Returns true if each partition is empty.
Locks the all partitions to perform this check, but insertions can occur as soon as this method returns.
|
inline |
Erases one entry from the partitioned structure.
Locks only the partition given by the key. Returns the number of entries removed.
|
delete |
|
inline |
Inserts a single value into the partitioned structure.
Locks a single partition determined by the value itself. Will not lock any partitions besides the one inserted into.
|
delete |
|
inline |
|
inline |
|
inline |
|
delete |
|
default |
|
inline |
Returns the number of elements in all partitions, summed together.
Locks all partitions to do this computation, but the size can change as soon as this method returns.
|
mutableprivate |
|
private |