forked from lix-project/lix
nar-info-disk-cache: include ca in the cache entries
Without this information the content addressable state and hashes are lost after the first request, this causes signatures to be required for everything even tho the path could be verified without signing.
This commit is contained in:
parent
18ecd087ae
commit
6f89053108
|
@ -31,6 +31,7 @@ create table if not exists NARs (
|
||||||
refs text,
|
refs text,
|
||||||
deriver text,
|
deriver text,
|
||||||
sigs text,
|
sigs text,
|
||||||
|
ca text,
|
||||||
timestamp integer not null,
|
timestamp integer not null,
|
||||||
present integer not null,
|
present integer not null,
|
||||||
primary key (cache, hashPart),
|
primary key (cache, hashPart),
|
||||||
|
@ -72,7 +73,7 @@ public:
|
||||||
{
|
{
|
||||||
auto state(_state.lock());
|
auto state(_state.lock());
|
||||||
|
|
||||||
Path dbPath = getCacheDir() + "/nix/binary-cache-v5.sqlite";
|
Path dbPath = getCacheDir() + "/nix/binary-cache-v6.sqlite";
|
||||||
createDirs(dirOf(dbPath));
|
createDirs(dirOf(dbPath));
|
||||||
|
|
||||||
state->db = SQLite(dbPath);
|
state->db = SQLite(dbPath);
|
||||||
|
@ -94,7 +95,7 @@ public:
|
||||||
|
|
||||||
state->insertNAR.create(state->db,
|
state->insertNAR.create(state->db,
|
||||||
"insert or replace into NARs(cache, hashPart, namePart, url, compression, fileHash, fileSize, narHash, "
|
"insert or replace into NARs(cache, hashPart, namePart, url, compression, fileHash, fileSize, narHash, "
|
||||||
"narSize, refs, deriver, sigs, timestamp, present) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1)");
|
"narSize, refs, deriver, sigs, ca, timestamp, present) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1)");
|
||||||
|
|
||||||
state->insertMissingNAR.create(state->db,
|
state->insertMissingNAR.create(state->db,
|
||||||
"insert or replace into NARs(cache, hashPart, timestamp, present) values (?, ?, ?, 0)");
|
"insert or replace into NARs(cache, hashPart, timestamp, present) values (?, ?, ?, 0)");
|
||||||
|
@ -210,6 +211,7 @@ public:
|
||||||
narInfo->deriver = cache.storeDir + "/" + queryNAR.getStr(10);
|
narInfo->deriver = cache.storeDir + "/" + queryNAR.getStr(10);
|
||||||
for (auto & sig : tokenizeString<Strings>(queryNAR.getStr(11), " "))
|
for (auto & sig : tokenizeString<Strings>(queryNAR.getStr(11), " "))
|
||||||
narInfo->sigs.insert(sig);
|
narInfo->sigs.insert(sig);
|
||||||
|
narInfo->ca = queryNAR.getStr(12);
|
||||||
|
|
||||||
return {oValid, narInfo};
|
return {oValid, narInfo};
|
||||||
});
|
});
|
||||||
|
@ -243,6 +245,7 @@ public:
|
||||||
(concatStringsSep(" ", info->shortRefs()))
|
(concatStringsSep(" ", info->shortRefs()))
|
||||||
(info->deriver != "" ? baseNameOf(info->deriver) : "", info->deriver != "")
|
(info->deriver != "" ? baseNameOf(info->deriver) : "", info->deriver != "")
|
||||||
(concatStringsSep(" ", info->sigs))
|
(concatStringsSep(" ", info->sigs))
|
||||||
|
(info->ca)
|
||||||
(time(0)).exec();
|
(time(0)).exec();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue