From a824d58b566752b2a89a718fd628053754968d72 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 1 Dec 2006 20:51:18 +0000 Subject: * Merge addToStore and addToStoreFixed. * addToStore now adds unconditionally, it doesn't use readOnlyMode. Read-only operation is up to the caller (who can call computeStorePathForPath). --- src/libstore/local-store.cc | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'src/libstore/local-store.cc') diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index ed948cf4e5aa..2f2a1b436635 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -619,20 +619,20 @@ static void invalidatePath(Transaction & txn, const Path & path) } -Path LocalStore::_addToStore(bool fixed, bool recursive, - string hashAlgo, const Path & _srcPath) +Path LocalStore::addToStore(const Path & _srcPath, bool fixed, + bool recursive, string hashAlgo) { Path srcPath(absPath(_srcPath)); debug(format("adding `%1%' to the store") % srcPath); std::pair pr = - computeStorePathForPath(fixed, recursive, hashAlgo, srcPath); + computeStorePathForPath(srcPath, fixed, recursive, hashAlgo); Path & dstPath(pr.first); Hash & h(pr.second); - if (!readOnlyMode) addTempRoot(dstPath); + addTempRoot(dstPath); - if (!readOnlyMode && !isValidPath(dstPath)) { + if (!isValidPath(dstPath)) { /* The first check above is an optimisation to prevent unnecessary lock acquisition. */ @@ -664,26 +664,14 @@ Path LocalStore::_addToStore(bool fixed, bool recursive, } -Path LocalStore::addToStore(const Path & srcPath) -{ - return _addToStore(false, false, "", srcPath); -} - - -Path LocalStore::addToStoreFixed(bool recursive, string hashAlgo, const Path & srcPath) -{ - return _addToStore(true, recursive, hashAlgo, srcPath); -} - - Path LocalStore::addTextToStore(const string & suffix, const string & s, const PathSet & references) { Path dstPath = computeStorePathForText(suffix, s); - if (!readOnlyMode) addTempRoot(dstPath); + addTempRoot(dstPath); - if (!readOnlyMode && !isValidPath(dstPath)) { + if (!isValidPath(dstPath)) { PathLocks outputLock(singleton(dstPath)); -- cgit 1.4.1