| 377 | } |
| 378 | |
| 379 | void |
| 380 | SimpleDatabase::Mount(const char *uri, DatabasePtr db) |
| 381 | { |
| 382 | #if !CLANG_CHECK_VERSION(3,6) |
| 383 | /* disabled on clang due to -Wtautological-pointer-compare */ |
| 384 | assert(uri != nullptr); |
| 385 | #endif |
| 386 | assert(db != nullptr); |
| 387 | assert(*uri != 0); |
| 388 | |
| 389 | ScopeDatabaseLock protect; |
| 390 | |
| 391 | auto r = root->LookupDirectory(uri); |
| 392 | if (r.rest.data() == nullptr) |
| 393 | throw DatabaseError(DatabaseErrorCode::CONFLICT, |
| 394 | "Already exists"); |
| 395 | |
| 396 | if (r.rest.find('/') != std::string_view::npos) |
| 397 | throw DatabaseError(DatabaseErrorCode::NOT_FOUND, |
| 398 | "Parent not found"); |
| 399 | |
| 400 | Directory *mnt = r.directory->CreateChild(r.rest); |
| 401 | mnt->mounted_database = std::move(db); |
| 402 | } |
| 403 | |
| 404 | static constexpr bool |
| 405 | IsSafeChar(char ch) |
nothing calls this directly
no test coverage detected