1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Remove the "locked" flag from the fetcher cache

This also reworks the Mercurial fetcher (which was still using the
old cache interface) to have two distinct cache mappings:

* A ref-to-rev mapping, which is store-independent.
* A rev-to-store-path mapping.
This commit is contained in:
Eelco Dolstra 2024-04-10 12:46:21 +02:00
parent 03eb4f7baa
commit d084c1cb41
6 changed files with 45 additions and 58 deletions

View file

@ -14,7 +14,7 @@ create table if not exists Cache (
input text not null,
info text not null,
path text not null,
immutable integer not null,
immutable integer not null, /* obsolete */
timestamp integer not null,
primary key (input)
);
@ -45,7 +45,7 @@ struct CacheImpl : Cache
state->db.exec(schema);
state->add.create(state->db,
"insert or replace into Cache(input, info, path, immutable, timestamp) values (?, ?, ?, ?, ?)");
"insert or replace into Cache(input, info, path, immutable, timestamp) values (?, ?, ?, false, ?)");
state->lookup.create(state->db,
"select info, path, immutable, timestamp from Cache where input = ?");
@ -59,7 +59,6 @@ struct CacheImpl : Cache
(attrsToJSON(inAttrs).dump())
(attrsToJSON(infoAttrs).dump())
("") // no path
(false)
(time(0)).exec();
}
@ -109,14 +108,12 @@ struct CacheImpl : Cache
Store & store,
const Attrs & inAttrs,
const Attrs & infoAttrs,
const StorePath & storePath,
bool locked) override
const StorePath & storePath) override
{
_state.lock()->add.use()
(attrsToJSON(inAttrs).dump())
(attrsToJSON(infoAttrs).dump())
(store.printStorePath(storePath))
(locked)
(time(0)).exec();
}