26#ifndef TEMPTABLE_KV_STORE_H
27#define TEMPTABLE_KV_STORE_H
29#include <shared_mutex>
31#include <unordered_map>
56template <
typename Lock,
76 std::conditional_t<std::is_same<Lock, std::shared_timed_mutex>::value,
77 std::shared_lock<Lock>, std::lock_guard<Lock>>;
98 template <
class... Args>
99 std::pair<typename Key_value_store_impl::iterator, bool>
emplace(
116 return &iter->second;
127 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:41
void dbug_print()
Definition: kv_store_logger.h:46
void log(Key_value_store_stats::Event)
Definition: kv_store_logger.h:43
Key-value store, a convenience wrapper class which models a thread-safe dictionary type.
Definition: kv_store.h:60
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:77
Key_value_store_impl m_kv_store
Container holding (table-name, Table) tuples.
Definition: kv_store.h:83
KeyValueImpl< std::string, Table > Key_value_store_impl
Alias for our key-value store implementation.
Definition: kv_store.h:80
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:127
Table * find(const std::string &key)
Searches for a table with given name (key).
Definition: kv_store.h:112
Lock m_lock
Lock type.
Definition: kv_store.h:86
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:99
TempTable key-value store logger implementation.
Definition: allocator.h:44
constexpr bool DEBUG_BUILD
Store build-type information into the constexpr expression.
Definition: constants.h:75
std::unordered_map< Key, Value, Hash, Key_equal, ut::allocator< std::pair< const Key, Value > > > unordered_map
Definition: ut0new.h:2897
static std::mutex lock
Definition: net_ns.cc:55
required string key
Definition: replication_asynchronous_connection_failover.proto:59