From 92f525ecf4ea8a9bd356acd1d3845074b1e5b918 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 25 Mar 2009 21:05:42 +0000 Subject: * Negative caching, i.e. caching of build failures. Disabled by default. This is mostly useful for Hydra. --- src/libstore/local-store.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/libstore/local-store.cc') diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index fdfc8534662a..7ab7e4e8e375 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -65,6 +65,7 @@ LocalStore::LocalStore() createDirs(nixDBPath + "/info"); createDirs(nixDBPath + "/referrer"); + createDirs(nixDBPath + "/failed"); int curSchema = getSchema(); if (curSchema > nixSchemaVersion) @@ -196,6 +197,13 @@ static Path referrersFileFor(const Path & path) } +static Path failedFileFor(const Path & path) +{ + string baseName = baseNameOf(path); + return (format("%1%/failed/%2%") % nixDBPath % baseName).str(); +} + + static Path tmpFileForAtomicUpdate(const Path & path) { return (format("%1%/.%2%.%3%") % dirOf(path) % getpid() % baseNameOf(path)).str(); @@ -335,6 +343,20 @@ void LocalStore::registerValidPath(const ValidPathInfo & info, bool ignoreValidi } +void LocalStore::registerFailedPath(const Path & path) +{ + /* Write an empty file in the .../failed directory to denote the + failure of the builder for `path'. */ + writeFile(failedFileFor(path), ""); +} + + +bool LocalStore::hasPathFailed(const Path & path) +{ + return pathExists(failedFileFor(path)); +} + + Hash parseHashField(const Path & path, const string & s) { string::size_type colon = s.find(':'); -- cgit 1.4.1