Storage: Add CreateEntry function for Dispatcher use.

This commit is contained in:
Peter Johnson
2015-07-28 22:06:42 -07:00
parent a0d30ffef1
commit 5823e3c780
2 changed files with 14 additions and 0 deletions

View File

@@ -23,6 +23,17 @@ Storage::Storage() {
Storage::~Storage() {}
std::shared_ptr<StorageEntry> Storage::CreateEntry(StringRef name,
std::shared_ptr<Value> value,
unsigned int flags) {
std::lock_guard<std::mutex> lock(m_mutex);
auto& entry = m_entries[name];
if (!entry) entry = std::make_shared<StorageEntry>(name);
entry->set_value(value);
entry->set_flags(flags);
return entry;
}
void Storage::GetUpdates(UpdateMap* updates, bool* delete_all) {
std::lock_guard<std::mutex> lock(m_mutex);
m_updates.swap(*updates);