| 106 | } |
| 107 | |
| 108 | std::optional<DataStorageReference> DataStorageService::CreateDataStorage(const std::string& label) |
| 109 | { |
| 110 | if (label.empty()) |
| 111 | { |
| 112 | return std::nullopt; |
| 113 | } |
| 114 | |
| 115 | std::lock_guard<std::mutex> lock(m_Mutex); |
| 116 | |
| 117 | // Check for duplicate label |
| 118 | if (label == DEFAULT_LABEL || this->FindStorageByLabel(label).IsValid()) |
| 119 | { |
| 120 | return std::nullopt; |
| 121 | } |
| 122 | |
| 123 | auto storage = StandaloneDataStorage::New(); |
| 124 | DataStorageReference dsRef(label, storage.GetPointer(), false); |
| 125 | m_Storages.push_back(dsRef); |
| 126 | |
| 127 | return dsRef; |
| 128 | } |
| 129 | |
| 130 | std::optional<DataStorageReference> DataStorageService::GetDataStorageReference(const std::string& label) const |
| 131 | { |