27#ifndef TEMPTABLE_KV_STORE_H
28#define TEMPTABLE_KV_STORE_H
30#include <shared_mutex>
32#include <unordered_map>
57template <
typename Lock,
77 std::conditional_t<std::is_same<Lock, std::shared_timed_mutex>::value,
78 std::shared_lock<Lock>, std::lock_guard<Lock>>;
99 template <
class... Args>
100 std::pair<typename Key_value_store_impl::iterator, bool>
emplace(
117 return &iter->second;
128 typename Key_value_store_impl::size_type
erase(
const std::string &
key) {
Default Key_value_store logging facility which turns to no-op in non-debug builds.
Definition: kv_store_logger.h:42
void dbug_print()
Definition: kv_store_logger.h:47
void log(Key_value_store_stats::Event)
Definition: kv_store_logger.h:44
Key-value store, a convenience wrapper class which models a thread-safe dictionary type.
Definition: kv_store.h:61
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 ...
Definition: kv_store.h:100
std::conditional_t< std::is_same< Lock, std::shared_timed_mutex >::value, std::shared_lock< Lock >, std::lock_guard< Lock > > Exclusive_or_shared_lock
Check whether we can use shared locks (which enable multiple concurrent readers) or must we rather fa...
Definition: kv_store.h:78
Key_value_store_impl m_kv_store
Container holding (table-name, Table) tuples.
Definition: kv_store.h:84
KeyValueImpl< std::string, Table > Key_value_store_impl
Alias for our key-value store implementation.
Definition: kv_store.h:81
Key_value_store_impl::size_type erase(const std::string &key)
Removes the table (if one exists) with the given name (key).
Definition: kv_store.h:128
Table * find(const std::string &key)
Searches for a table with given name (key).
Definition: kv_store.h:113
Lock m_lock
Lock type.
Definition: kv_store.h:87
TempTable key-value store logger implementation.
Definition: allocator.h:45
constexpr bool DEBUG_BUILD
Store build-type information into the constexpr expression.
Definition: constants.h:76
std::unordered_map< Key, Value, Hash, Key_equal, ut::allocator< std::pair< const Key, Value > > > unordered_map
Definition: ut0new.h:2899
static std::mutex lock
Definition: net_ns.cc:56
required string key
Definition: replication_asynchronous_connection_failover.proto:60