libstore: asyncify LocalStore::invalidatePathChecked

Change-Id: I425b155e98d4d85f6d2f91841cbb8725e195a607
This commit is contained in:
eldritch horrors
2025-03-05 18:49:45 +01:00
parent d5d498ab22
commit e057497f3e
3 changed files with 26 additions and 17 deletions
+1 -1
View File
@@ -793,7 +793,7 @@ try {
if (!dead.insert(path).second) continue;
if (shouldDelete) {
try {
invalidatePathChecked(path);
TRY_AWAIT(invalidatePathChecked(path));
deleteFromStore(path.to_string());
referrersCache.erase(path);
} catch (PathInUse &) {
+13 -4
View File
@@ -1622,9 +1622,11 @@ std::pair<Path, AutoCloseFD> LocalStore::createTempDirInStore()
}
void LocalStore::invalidatePathChecked(const StorePath & path)
{
retrySQLite([&]() {
kj::Promise<Result<void>> LocalStore::invalidatePathChecked(const StorePath & path)
try {
// NOLINTNEXTLINE(cppcoreguidelines-avoid-capturing-lambda-coroutines)
TRY_AWAIT(retrySQLite([&]() -> kj::Promise<Result<void>> {
try {
auto state = dbPool.get();
SQLiteTxn txn = state->db.beginTransaction(SQLiteTxnType::Immediate);
@@ -1639,7 +1641,14 @@ void LocalStore::invalidatePathChecked(const StorePath & path)
}
txn.commit();
}, always_progresses);
co_return result::success();
} catch (...) {
co_return result::current_exception();
}
}));
co_return result::success();
} catch (...) {
co_return result::current_exception();
}
+1 -1
View File
@@ -359,7 +359,7 @@ private:
/**
* Delete a path from the Nix store.
*/
void invalidatePathChecked(const StorePath & path);
kj::Promise<Result<void>> invalidatePathChecked(const StorePath & path);
kj::Promise<Result<void>> verifyPath(const StorePath & path, const StorePathSet & store,
StorePathSet & done, StorePathSet & validPaths, RepairFlag repair, bool & errors);