mirror of
https://github.com/NixOS/nix.git
synced 2025-11-20 17:29:36 +01:00
* Get derivation outputs from the database instead of the .drv file,
which requires more I/O.
This commit is contained in:
parent
103cfee056
commit
c4d388add4
7 changed files with 46 additions and 8 deletions
|
|
@ -299,6 +299,8 @@ void LocalStore::prepareStatements()
|
|||
"insert or replace into DerivationOutputs (drv, id, path) values (?, ?, ?);");
|
||||
stmtQueryValidDerivers.create(db,
|
||||
"select v.id, v.path from DerivationOutputs d join ValidPaths v on d.drv = v.id where d.path = ?;");
|
||||
stmtQueryDerivationOutputs.create(db,
|
||||
"select id, path from DerivationOutputs where drv = ?;");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -623,6 +625,28 @@ PathSet LocalStore::queryValidDerivers(const Path & path)
|
|||
}
|
||||
|
||||
|
||||
PathSet LocalStore::queryDerivationOutputs(const Path & path)
|
||||
{
|
||||
SQLiteTxn txn(db);
|
||||
|
||||
SQLiteStmtUse use(stmtQueryDerivationOutputs);
|
||||
stmtQueryDerivationOutputs.bind(queryPathInfo(path).id);
|
||||
|
||||
PathSet outputs;
|
||||
int r;
|
||||
while ((r = sqlite3_step(stmtQueryDerivationOutputs)) == SQLITE_ROW) {
|
||||
const char * s = (const char *) sqlite3_column_text(stmtQueryDerivationOutputs, 1);
|
||||
assert(s);
|
||||
outputs.insert(s);
|
||||
}
|
||||
|
||||
if (r != SQLITE_DONE)
|
||||
throw SQLiteError(db, format("error getting outputs of `%1%'") % path);
|
||||
|
||||
return outputs;
|
||||
}
|
||||
|
||||
|
||||
void LocalStore::startSubstituter(const Path & substituter, RunningSubstituter & run)
|
||||
{
|
||||
if (run.pid != -1) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue