10#include <unordered_map>
13namespace traffic_manager {
15 template <
typename Key,
typename Value>
21 std::unordered_map<Key, Value>
map;
27 void AddEntry(
const std::pair<Key, Value> &entry) {
29 std::lock_guard<std::mutex> lock(
map_mutex);
30 const Key& key = entry.first;
31 if (
map.find(key) !=
map.end()) {
32 map.at(key) = entry.second;
40 std::lock_guard<std::mutex> lock(
map_mutex);
41 return map.find(key) !=
map.end();
46 std::lock_guard<std::mutex> lock(
map_mutex);
52 std::lock_guard<std::mutex> lock(
map_mutex);
std::unordered_map< Key, Value > map
void RemoveEntry(const Key &key)
const Value & GetValue(const Key &key) const
bool Contains(const Key &key) const
void AddEntry(const std::pair< Key, Value > &entry)
This file contains definitions of common data structures used in traffic manager.