diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-12-01T20·51+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-12-01T20·51+0000 |
commit | a824d58b566752b2a89a718fd628053754968d72 (patch) | |
tree | ff624d24dbbc61e199d699aa32e7bcf54773de39 /src/libstore/remote-store.cc | |
parent | ceb982a1be381d59532d0405451f38d263abb617 (diff) |
* 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).
Diffstat (limited to 'src/libstore/remote-store.cc')
-rw-r--r-- | src/libstore/remote-store.cc | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index e04bb6713934..bcae21bf7650 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -3,7 +3,6 @@ #include "remote-store.hh" #include "worker-protocol.hh" #include "archive.hh" -#include "globals.hh" #include <iostream> #include <unistd.h> @@ -123,33 +122,14 @@ void RemoteStore::queryReferrers(const Path & path, } -Path RemoteStore::addToStore(const Path & srcPath) +Path RemoteStore::addToStore(const Path & _srcPath, bool fixed, + bool recursive, string hashAlgo) { - if (readOnlyMode) { - /* No sense in making a round trip, we can just compute the - path here. */ - return computeStorePathForPath(false, false, "", srcPath).first; - } + Path srcPath(absPath(_srcPath)); writeInt(wopAddToStore, to); writeString(baseNameOf(srcPath), to); - dumpPath(srcPath, to); - Path path = readString(from); - return path; -} - - -Path RemoteStore::addToStoreFixed(bool recursive, string hashAlgo, - const Path & srcPath) -{ - if (readOnlyMode) { - /* No sense in making a round trip, we can just compute the - path here. */ - return computeStorePathForPath(true, recursive, hashAlgo, srcPath).first; - } - - writeInt(wopAddToStoreFixed, to); - writeString(baseNameOf(srcPath), to); + writeInt(fixed ? 1 : 0, to); writeInt(recursive ? 1 : 0, to); writeString(hashAlgo, to); dumpPath(srcPath, to); @@ -161,10 +141,6 @@ Path RemoteStore::addToStoreFixed(bool recursive, string hashAlgo, Path RemoteStore::addTextToStore(const string & suffix, const string & s, const PathSet & references) { - if (readOnlyMode) { - return computeStorePathForText(suffix, s); - } - writeInt(wopAddTextToStore, to); writeString(suffix, to); writeString(s, to); |