forked from lix-project/lix
parent
c51ee5c033
commit
8af4f886e2
|
@ -736,11 +736,19 @@ void LocalStore::queryPathInfoUncached(const StorePath & path,
|
||||||
Callback<std::shared_ptr<const ValidPathInfo>> callback) noexcept
|
Callback<std::shared_ptr<const ValidPathInfo>> callback) noexcept
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
callback(retrySQLite<std::shared_ptr<ValidPathInfo>>([&]() {
|
callback(retrySQLite<std::shared_ptr<const ValidPathInfo>>([&]() {
|
||||||
auto state(_state.lock());
|
auto state(_state.lock());
|
||||||
|
return queryPathInfoInternal(*state, path);
|
||||||
|
}));
|
||||||
|
|
||||||
|
} catch (...) { callback.rethrow(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::shared_ptr<const ValidPathInfo> LocalStore::queryPathInfoInternal(State & state, const StorePath & path)
|
||||||
|
{
|
||||||
/* Get the path info. */
|
/* Get the path info. */
|
||||||
auto useQueryPathInfo(state->stmts->QueryPathInfo.use()(printStorePath(path)));
|
auto useQueryPathInfo(state.stmts->QueryPathInfo.use()(printStorePath(path)));
|
||||||
|
|
||||||
if (!useQueryPathInfo.next())
|
if (!useQueryPathInfo.next())
|
||||||
return std::shared_ptr<ValidPathInfo>();
|
return std::shared_ptr<ValidPathInfo>();
|
||||||
|
@ -760,7 +768,7 @@ void LocalStore::queryPathInfoUncached(const StorePath & path,
|
||||||
|
|
||||||
info->registrationTime = useQueryPathInfo.getInt(2);
|
info->registrationTime = useQueryPathInfo.getInt(2);
|
||||||
|
|
||||||
auto s = (const char *) sqlite3_column_text(state->stmts->QueryPathInfo, 3);
|
auto s = (const char *) sqlite3_column_text(state.stmts->QueryPathInfo, 3);
|
||||||
if (s) info->deriver = parseStorePath(s);
|
if (s) info->deriver = parseStorePath(s);
|
||||||
|
|
||||||
/* Note that narSize = NULL yields 0. */
|
/* Note that narSize = NULL yields 0. */
|
||||||
|
@ -768,22 +776,19 @@ void LocalStore::queryPathInfoUncached(const StorePath & path,
|
||||||
|
|
||||||
info->ultimate = useQueryPathInfo.getInt(5) == 1;
|
info->ultimate = useQueryPathInfo.getInt(5) == 1;
|
||||||
|
|
||||||
s = (const char *) sqlite3_column_text(state->stmts->QueryPathInfo, 6);
|
s = (const char *) sqlite3_column_text(state.stmts->QueryPathInfo, 6);
|
||||||
if (s) info->sigs = tokenizeString<StringSet>(s, " ");
|
if (s) info->sigs = tokenizeString<StringSet>(s, " ");
|
||||||
|
|
||||||
s = (const char *) sqlite3_column_text(state->stmts->QueryPathInfo, 7);
|
s = (const char *) sqlite3_column_text(state.stmts->QueryPathInfo, 7);
|
||||||
if (s) info->ca = parseContentAddressOpt(s);
|
if (s) info->ca = parseContentAddressOpt(s);
|
||||||
|
|
||||||
/* Get the references. */
|
/* Get the references. */
|
||||||
auto useQueryReferences(state->stmts->QueryReferences.use()(info->id));
|
auto useQueryReferences(state.stmts->QueryReferences.use()(info->id));
|
||||||
|
|
||||||
while (useQueryReferences.next())
|
while (useQueryReferences.next())
|
||||||
info->references.insert(parseStorePath(useQueryReferences.getStr(0)));
|
info->references.insert(parseStorePath(useQueryReferences.getStr(0)));
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}));
|
|
||||||
|
|
||||||
} catch (...) { callback.rethrow(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1608,7 +1613,7 @@ void LocalStore::addSignatures(const StorePath & storePath, const StringSet & si
|
||||||
|
|
||||||
SQLiteTxn txn(state->db);
|
SQLiteTxn txn(state->db);
|
||||||
|
|
||||||
auto info = std::const_pointer_cast<ValidPathInfo>(std::shared_ptr<const ValidPathInfo>(queryPathInfo(storePath)));
|
auto info = std::const_pointer_cast<ValidPathInfo>(queryPathInfoInternal(*state, storePath));
|
||||||
|
|
||||||
info->sigs.insert(sigs.begin(), sigs.end());
|
info->sigs.insert(sigs.begin(), sigs.end());
|
||||||
|
|
||||||
|
|
|
@ -235,6 +235,8 @@ private:
|
||||||
void verifyPath(const Path & path, const StringSet & store,
|
void verifyPath(const Path & path, const StringSet & store,
|
||||||
PathSet & done, StorePathSet & validPaths, RepairFlag repair, bool & errors);
|
PathSet & done, StorePathSet & validPaths, RepairFlag repair, bool & errors);
|
||||||
|
|
||||||
|
std::shared_ptr<const ValidPathInfo> queryPathInfoInternal(State & state, const StorePath & path);
|
||||||
|
|
||||||
void updatePathInfo(State & state, const ValidPathInfo & info);
|
void updatePathInfo(State & state, const ValidPathInfo & info);
|
||||||
|
|
||||||
void upgradeStore6();
|
void upgradeStore6();
|
||||||
|
|
Loading…
Reference in a new issue