| 1101 | } |
| 1102 | |
| 1103 | DataStorageBridge::OperationStatus DataStorageBridge::DeleteNodeProperty( |
| 1104 | const std::string& uid, |
| 1105 | const std::string& key, |
| 1106 | const PropertyQueryParams& params) |
| 1107 | { |
| 1108 | // Reject deletion of internal properties (no dispatch needed for this check) |
| 1109 | if (IsInternalProperty(key)) |
| 1110 | { |
| 1111 | return OperationStatus::InvalidInput; |
| 1112 | } |
| 1113 | |
| 1114 | // Mutation operations only support Node and Data scopes, not All |
| 1115 | if (params.scope == PropertyScope::All) |
| 1116 | { |
| 1117 | return OperationStatus::InvalidInput; |
| 1118 | } |
| 1119 | |
| 1120 | std::lock_guard<std::mutex> lock(m_Mutex); |
| 1121 | return this->DispatchTask<OperationStatus>([this, uid, key, params]() |
| 1122 | { |
| 1123 | auto dataStorage = m_DataStorage.Lock(); |
| 1124 | if (dataStorage.IsNull()) |
| 1125 | { |
| 1126 | return OperationStatus::InternalError; |
| 1127 | } |
| 1128 | |
| 1129 | auto node = m_UidMapper->FindNodeByUid(uid); |
| 1130 | if (node == nullptr) |
| 1131 | { |
| 1132 | return OperationStatus::NodeNotFound; |
| 1133 | } |
| 1134 | |
| 1135 | const std::string contextName = params.context.has_value() ? params.context.value() : ""; |
| 1136 | PropertyList* propertyList = nullptr; |
| 1137 | |
| 1138 | if (params.scope == PropertyScope::Data) |
| 1139 | { |
| 1140 | auto data = node->GetData(); |
| 1141 | if (data != nullptr) |
| 1142 | { |
| 1143 | propertyList = data->GetPropertyList(); |
| 1144 | } |
| 1145 | } |
| 1146 | else |
| 1147 | { |
| 1148 | propertyList = node->GetPropertyList(contextName); |
| 1149 | } |
| 1150 | |
| 1151 | if (propertyList == nullptr) |
| 1152 | { |
| 1153 | return OperationStatus::InternalError; |
| 1154 | } |
| 1155 | |
| 1156 | // Verify the property actually exists in the targeted scope |
| 1157 | auto prop = GetConstProperty(node, key, params.context, params.scope); |
| 1158 | if (prop == nullptr) |
| 1159 | { |
| 1160 | return OperationStatus::PropertyNotFound; |
no test coverage detected