Storage: Make testable, make EntriesMap typedef private.

This commit is contained in:
Peter Johnson
2015-07-19 16:36:30 -07:00
parent 173111c64c
commit 21b7acc397

View File

@@ -22,6 +22,8 @@
namespace nt {
class StorageTest;
class StorageEntry {
public:
StorageEntry() : m_flags(0), m_id(0xffff) {}
@@ -70,6 +72,7 @@ class StorageEntry {
};
class Storage {
friend class StorageTest;
public:
static Storage& GetInstance() {
if (!m_instance) m_instance.reset(new Storage);
@@ -77,8 +80,6 @@ class Storage {
}
~Storage();
typedef llvm::StringMap<std::shared_ptr<StorageEntry>> EntriesMap;
struct Update {
std::shared_ptr<StorageEntry> entry;
enum Kind { kAssign, kValueUpdate, kFlagsUpdate, kDelete, kDeleteAll };
@@ -111,6 +112,8 @@ class Storage {
Storage(const Storage&) = delete;
Storage& operator=(const Storage&) = delete;
typedef llvm::StringMap<std::shared_ptr<StorageEntry>> EntriesMap;
mutable std::mutex m_mutex;
EntriesMap m_entries;
UpdateQueue m_updates;