| 230 | } |
| 231 | |
| 232 | void DaemonStateIndex::_insert(DaemonStatePtr dm) |
| 233 | { |
| 234 | if (all.count(dm->key)) { |
| 235 | _erase(dm->key); |
| 236 | } |
| 237 | |
| 238 | by_server[dm->hostname][dm->key] = dm; |
| 239 | all[dm->key] = dm; |
| 240 | |
| 241 | for (auto& i : dm->devices) { |
| 242 | auto d = _get_or_create_device(i.first); |
| 243 | d->daemons.insert(dm->key); |
| 244 | auto p = dm->devices_bypath.find(i.first); |
| 245 | if (p != dm->devices_bypath.end()) { |
| 246 | d->attachments.insert(std::make_tuple(dm->hostname, i.second, p->second)); |
| 247 | } else { |
| 248 | d->attachments.insert(std::make_tuple(dm->hostname, i.second, |
| 249 | std::string())); |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | void DaemonStateIndex::_erase(const DaemonKey& dmk) |
| 255 | { |