MySQL 8.0.39
Source Code Documentation
|
Key-value store, a convenience wrapper class which models a thread-safe dictionary type. More...
#include <kv_store.h>
Public Member Functions | |
template<class... Args> | |
std::pair< typename Key_value_store_impl::iterator, bool > | emplace (Args &&... args) |
Inserts a new table into the container constructed in-place with the given args if there is no table with the key in the container. More... | |
Table * | find (const std::string &key) |
Searches for a table with given name (key). More... | |
Key_value_store_impl::size_type | erase (const std::string &key) |
Removes the table (if one exists) with the given name (key). More... | |
Private Types | |
using | Exclusive_or_shared_lock = std::conditional_t< std::is_same< Lock, std::shared_timed_mutex >::value, std::shared_lock< Lock >, std::lock_guard< Lock > > |
Check whether we can use shared locks (which enable multiple concurrent readers) or must we rather fallback to exclusive locks. More... | |
using | Key_value_store_impl = KeyValueImpl< std::string, Table > |
Alias for our key-value store implementation. More... | |
Private Attributes | |
Key_value_store_impl | m_kv_store |
Container holding (table-name, Table) tuples. More... | |
Lock | m_lock |
Lock type. More... | |
Friends | |
class | Key_value_store_logger< Key_value_store< Lock, KeyValueImpl >, DEBUG_BUILD > |
Do not break encapsulation when using CRTP. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from temptable::Key_value_store_logger< Key_value_store< Lock, std::unordered_map >, DEBUG_BUILD > | |
void | log (Key_value_store_stats::Event) |
void | dbug_print () |
Key-value store, a convenience wrapper class which models a thread-safe dictionary type.
Thread-safety is accomplished by using a Lock
which can be any of the usual mutual exclusive algorithms from C++ thread-support library or any other which satisfy C++ concurrency named requirements. E.g. mutex, timed_mutex, recursive_mutex, recursive_timed_mutex, shared_mutex, shared_timed_mutex, ... User code can opt-in for any of those. Also, whether the actual implementation will use shared-locks or exclusive-locks (for read-only operations) is handled automagically by this class.
Furthermore, user code can similarly opt-in for different key-value implementation but whose interface is compatible with the one of std::unordered_map.
|
private |
Check whether we can use shared locks (which enable multiple concurrent readers) or must we rather fallback to exclusive locks.
Shared-locks will be used only during read-only operations.
|
private |
Alias for our key-value store implementation.
|
inline |
Inserts a new table into the container constructed in-place with the given args if there is no table with the key in the container.
[in] args Arguments to forward to the constructor of the table.
|
inline |
Removes the table (if one exists) with the given name (key).
[in] key Name of a table to remove..
|
inline |
Searches for a table with given name (key).
[in] key Name of a table to search for.
|
friend |
Do not break encapsulation when using CRTP.
|
private |
Container holding (table-name, Table) tuples.
|
private |
Lock type.