| 606 | } |
| 607 | |
| 608 | std::optional<DataStorageBridge::Json> DataStorageBridge::GetNode(const std::string& uid) const |
| 609 | { |
| 610 | std::lock_guard<std::mutex> lock(m_Mutex); |
| 611 | return this->DispatchTask<std::optional<Json>>([this, uid]() |
| 612 | { |
| 613 | auto dataStorage = m_DataStorage.Lock(); |
| 614 | if (dataStorage.IsNull()) |
| 615 | { |
| 616 | return std::optional<Json>(std::nullopt); |
| 617 | } |
| 618 | |
| 619 | auto node = m_UidMapper->FindNodeByUid(uid); |
| 620 | if (node == nullptr) |
| 621 | { |
| 622 | return std::optional<Json>(std::nullopt); |
| 623 | } |
| 624 | |
| 625 | return std::optional<Json>(this->NodeToJson(node)); |
| 626 | }); |
| 627 | } |
| 628 | |
| 629 | DataStorageBridge::CreateNodeResult DataStorageBridge::CreateNode(const Json& nodeData, const std::optional<std::string>& parentUid) |
| 630 | { |