From fa7cd5369b7d9f947b0b26ca681e94b81068a3ef Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 4 Feb 2016 14:48:42 +0100 Subject: [PATCH] StoreAPI -> Store Calling a class an API is a bit redundant... --- perl/lib/Nix/Store.xs | 6 +++--- src/libexpr/common-opts.hh | 2 +- src/libexpr/eval.cc | 2 +- src/libexpr/eval.hh | 6 +++--- src/libmain/shared.cc | 4 ++-- src/libmain/shared.hh | 6 +++--- src/libstore/derivations.cc | 4 ++-- src/libstore/derivations.hh | 6 +++--- src/libstore/download.cc | 2 +- src/libstore/download.hh | 4 ++-- src/libstore/gc.cc | 2 +- src/libstore/local-store.hh | 2 +- src/libstore/misc.cc | 8 ++++---- src/libstore/profiles.cc | 2 +- src/libstore/profiles.hh | 4 ++-- src/libstore/remote-store.hh | 2 +- src/libstore/store-api.cc | 10 +++++----- src/libstore/store-api.hh | 8 ++++---- src/nix-instantiate/nix-instantiate.cc | 2 +- src/nix-store/dotgraph.cc | 2 +- src/nix-store/dotgraph.hh | 4 ++-- src/nix-store/nix-store.cc | 8 ++++---- src/nix-store/xmlgraph.cc | 2 +- src/nix-store/xmlgraph.hh | 4 ++-- 24 files changed, 51 insertions(+), 51 deletions(-) diff --git a/perl/lib/Nix/Store.xs b/perl/lib/Nix/Store.xs index 76d3cc36a..5a1e8424f 100644 --- a/perl/lib/Nix/Store.xs +++ b/perl/lib/Nix/Store.xs @@ -19,9 +19,9 @@ using namespace nix; -static ref store() +static ref store() { - static std::shared_ptr _store; + static std::shared_ptr _store; if (!_store) { try { settings.processEnvironment(); @@ -33,7 +33,7 @@ static ref store() croak("%s", e.what()); } } - return ref(_store); + return ref(_store); } diff --git a/src/libexpr/common-opts.hh b/src/libexpr/common-opts.hh index 0500b0a83..cb2732d6f 100644 --- a/src/libexpr/common-opts.hh +++ b/src/libexpr/common-opts.hh @@ -4,7 +4,7 @@ namespace nix { -class StoreAPI; +class Store; /* Some common option parsing between nix-env and nix-instantiate. */ bool parseAutoArgs(Strings::iterator & i, diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 702b12ee4..de9454422 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -244,7 +244,7 @@ static Strings parseNixPath(const string & in) } -EvalState::EvalState(const Strings & _searchPath, ref store) +EvalState::EvalState(const Strings & _searchPath, ref store) : sWith(symbols.create("")) , sOutPath(symbols.create("outPath")) , sDrvPath(symbols.create("drvPath")) diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index a4286ce1f..cf2d57864 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -16,7 +16,7 @@ namespace nix { -class StoreAPI; +class Store; class EvalState; @@ -83,7 +83,7 @@ public: Value vEmptySet; - const ref store; + const ref store; private: SrcToStore srcToStore; @@ -100,7 +100,7 @@ private: public: - EvalState(const Strings & _searchPath, ref store); + EvalState(const Strings & _searchPath, ref store); ~EvalState(); void addToSearchPath(const string & s, bool warn = false); diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 656d04cab..88ed52497 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -46,7 +46,7 @@ void printGCWarning() } -void printMissing(ref store, const PathSet & paths) +void printMissing(ref store, const PathSet & paths) { unsigned long long downloadSize, narSize; PathSet willBuild, willSubstitute, unknown; @@ -55,7 +55,7 @@ void printMissing(ref store, const PathSet & paths) } -void printMissing(ref store, const PathSet & willBuild, +void printMissing(ref store, const PathSet & willBuild, const PathSet & willSubstitute, const PathSet & unknown, unsigned long long downloadSize, unsigned long long narSize) { diff --git a/src/libmain/shared.hh b/src/libmain/shared.hh index 6f826d8f6..e4b984f06 100644 --- a/src/libmain/shared.hh +++ b/src/libmain/shared.hh @@ -31,11 +31,11 @@ void printVersion(const string & programName); /* Ugh. No better place to put this. */ void printGCWarning(); -class StoreAPI; +class Store; -void printMissing(ref store, const PathSet & paths); +void printMissing(ref store, const PathSet & paths); -void printMissing(ref store, const PathSet & willBuild, +void printMissing(ref store, const PathSet & willBuild, const PathSet & willSubstitute, const PathSet & unknown, unsigned long long downloadSize, unsigned long long narSize); diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index da1747da0..d9b009d40 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -68,7 +68,7 @@ bool BasicDerivation::canBuildLocally() const } -Path writeDerivation(ref store, +Path writeDerivation(ref store, const Derivation & drv, const string & name, bool repair) { PathSet references; @@ -274,7 +274,7 @@ DrvHashes drvHashes; paths have been replaced by the result of a recursive call to this function, and that for fixed-output derivations we return a hash of its output path. */ -Hash hashDerivationModulo(StoreAPI & store, Derivation drv) +Hash hashDerivationModulo(Store & store, Derivation drv) { /* Return a fixed hash for fixed-output derivations. */ if (drv.isFixedOutput()) { diff --git a/src/libstore/derivations.hh b/src/libstore/derivations.hh index 4dda10b45..6f98869b0 100644 --- a/src/libstore/derivations.hh +++ b/src/libstore/derivations.hh @@ -80,11 +80,11 @@ struct Derivation : BasicDerivation }; -class StoreAPI; +class Store; /* Write a derivation to the Nix store, and return its path. */ -Path writeDerivation(ref store, +Path writeDerivation(ref store, const Derivation & drv, const string & name, bool repair = false); /* Read a derivation from a file. */ @@ -94,7 +94,7 @@ Derivation readDerivation(const Path & drvPath); derivations. */ bool isDerivation(const string & fileName); -Hash hashDerivationModulo(StoreAPI & store, Derivation drv); +Hash hashDerivationModulo(Store & store, Derivation drv); /* Memoisation of hashDerivationModulo(). */ typedef std::map DrvHashes; diff --git a/src/libstore/download.cc b/src/libstore/download.cc index 5e50c1480..01ce1ea2f 100644 --- a/src/libstore/download.cc +++ b/src/libstore/download.cc @@ -188,7 +188,7 @@ DownloadResult downloadFile(string url, const DownloadOptions & options) } -Path downloadFileCached(ref store, const string & url, bool unpack) +Path downloadFileCached(ref store, const string & url, bool unpack) { Path cacheDir = getEnv("XDG_CACHE_HOME", getEnv("HOME", "") + "/.cache") + "/nix/tarballs"; createDirs(cacheDir); diff --git a/src/libstore/download.hh b/src/libstore/download.hh index a727936d1..7aec8de73 100644 --- a/src/libstore/download.hh +++ b/src/libstore/download.hh @@ -19,11 +19,11 @@ struct DownloadResult string data, etag; }; -class StoreAPI; +class Store; DownloadResult downloadFile(string url, const DownloadOptions & options); -Path downloadFileCached(ref store, const string & url, bool unpack); +Path downloadFileCached(ref store, const string & url, bool unpack); MakeError(DownloadError, Error) diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index 9c158c3ee..48fb2167a 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -83,7 +83,7 @@ void LocalStore::addIndirectRoot(const Path & path) } -Path addPermRoot(ref store, const Path & _storePath, +Path addPermRoot(ref store, const Path & _storePath, const Path & _gcRoot, bool indirect, bool allowOutsideRootsDir) { Path storePath(canonPath(_storePath)); diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 3ef042b61..b6d39d345 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -80,7 +80,7 @@ struct SQLiteStmt }; -class LocalStore : public StoreAPI +class LocalStore : public Store { private: typedef std::map RunningSubstituters; diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc index 032dfe658..12472f017 100644 --- a/src/libstore/misc.cc +++ b/src/libstore/misc.cc @@ -7,7 +7,7 @@ namespace nix { -Derivation StoreAPI::derivationFromPath(const Path & drvPath) +Derivation Store::derivationFromPath(const Path & drvPath) { assertStorePath(drvPath); ensurePath(drvPath); @@ -15,7 +15,7 @@ Derivation StoreAPI::derivationFromPath(const Path & drvPath) } -void StoreAPI::computeFSClosure(const Path & path, +void Store::computeFSClosure(const Path & path, PathSet & paths, bool flipDirection, bool includeOutputs, bool includeDerivers) { if (paths.find(path) != paths.end()) return; @@ -59,7 +59,7 @@ void StoreAPI::computeFSClosure(const Path & path, } -void StoreAPI::queryMissing(const PathSet & targets, +void Store::queryMissing(const PathSet & targets, PathSet & willBuild, PathSet & willSubstitute, PathSet & unknown, unsigned long long & downloadSize, unsigned long long & narSize) { @@ -173,7 +173,7 @@ void StoreAPI::queryMissing(const PathSet & targets, } -Paths StoreAPI::topoSortPaths(const PathSet & paths) +Paths Store::topoSortPaths(const PathSet & paths) { Paths sorted; PathSet visited, parents; diff --git a/src/libstore/profiles.cc b/src/libstore/profiles.cc index 4903b12f6..8ab23cd31 100644 --- a/src/libstore/profiles.cc +++ b/src/libstore/profiles.cc @@ -74,7 +74,7 @@ static void makeName(const Path & profile, unsigned int num, } -Path createGeneration(ref store, Path profile, Path outPath) +Path createGeneration(ref store, Path profile, Path outPath) { /* The new generation number should be higher than old the previous ones. */ diff --git a/src/libstore/profiles.hh b/src/libstore/profiles.hh index 37d8ec999..d758d94b6 100644 --- a/src/libstore/profiles.hh +++ b/src/libstore/profiles.hh @@ -31,9 +31,9 @@ typedef list Generations; profile, sorted by generation number. */ Generations findGenerations(Path profile, int & curGen); -class StoreAPI; +class Store; -Path createGeneration(ref store, Path profile, Path outPath); +Path createGeneration(ref store, Path profile, Path outPath); void deleteGeneration(const Path & profile, unsigned int gen); diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index b0787c072..f15182285 100644 --- a/src/libstore/remote-store.hh +++ b/src/libstore/remote-store.hh @@ -14,7 +14,7 @@ struct FdSink; struct FdSource; -class RemoteStore : public StoreAPI +class RemoteStore : public Store { public: diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 98399cc48..e205fd0e8 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -220,7 +220,7 @@ Path computeStorePathForText(const string & name, const string & s, /* Return a string accepted by decodeValidPathInfo() that registers the specified paths as valid. Note: it's the responsibility of the caller to provide a closure. */ -string StoreAPI::makeValidityRegistration(const PathSet & paths, +string Store::makeValidityRegistration(const PathSet & paths, bool showDerivers, bool showHash) { string s = ""; @@ -284,7 +284,7 @@ string showPaths(const PathSet & paths) } -void StoreAPI::exportPaths(const Paths & paths, +void Store::exportPaths(const Paths & paths, bool sign, Sink & sink) { for (auto & i : paths) { @@ -306,7 +306,7 @@ void StoreAPI::exportPaths(const Paths & paths, namespace nix { -ref openStore(bool reserveSpace) +ref openStore(bool reserveSpace) { enum { mDaemon, mLocal, mAuto } mode; @@ -322,8 +322,8 @@ ref openStore(bool reserveSpace) } return mode == mDaemon - ? make_ref() - : make_ref(reserveSpace); + ? make_ref() + : make_ref(reserveSpace); } diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index ce085ff55..1e4306439 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -135,11 +135,11 @@ struct BasicDerivation; struct Derivation; -class StoreAPI +class Store { public: - virtual ~StoreAPI() { } + virtual ~Store() { } /* Check whether a path is valid. */ virtual bool isValidPath(const Path & path) = 0; @@ -407,13 +407,13 @@ void removeTempRoots(); /* Register a permanent GC root. */ -Path addPermRoot(ref store, const Path & storePath, +Path addPermRoot(ref store, const Path & storePath, const Path & gcRoot, bool indirect, bool allowOutsideRootsDir = false); /* Factory method: open the Nix database, either through the local or remote implementation. */ -ref openStore(bool reserveSpace = true); +ref openStore(bool reserveSpace = true); /* Display a set of paths in human-readable form (i.e., between quotes diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index a20c5ce63..1604c0817 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -32,7 +32,7 @@ static bool indirectRoot = false; enum OutputKind { okPlain, okXML, okJSON }; -void processExpr(ref store, EvalState & state, const Strings & attrPaths, +void processExpr(ref store, EvalState & state, const Strings & attrPaths, bool parseOnly, bool strict, Bindings & autoArgs, bool evalOnly, OutputKind output, bool location, Expr * e) { diff --git a/src/nix-store/dotgraph.cc b/src/nix-store/dotgraph.cc index 326c668e0..83472b0a3 100644 --- a/src/nix-store/dotgraph.cc +++ b/src/nix-store/dotgraph.cc @@ -94,7 +94,7 @@ void printClosure(const Path & nePath, const StoreExpr & fs) #endif -void printDotGraph(StoreAPI & store, const PathSet & roots) +void printDotGraph(Store & store, const PathSet & roots) { PathSet workList(roots); PathSet doneSet; diff --git a/src/nix-store/dotgraph.hh b/src/nix-store/dotgraph.hh index d3b37642c..d03c7d5b7 100644 --- a/src/nix-store/dotgraph.hh +++ b/src/nix-store/dotgraph.hh @@ -4,8 +4,8 @@ namespace nix { -class StoreAPI; +class Store; -void printDotGraph(StoreAPI & store, const PathSet & roots); +void printDotGraph(Store & store, const PathSet & roots); } diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index d5242492e..b384ad2ab 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -37,7 +37,7 @@ static Path gcRoot; static int rootNr = 0; static bool indirectRoot = false; static bool noOutput = false; -static std::shared_ptr store; +static std::shared_ptr store; LocalStore & ensureLocalStore() @@ -84,7 +84,7 @@ static PathSet realisePath(Path path, bool build = true) Path rootName = gcRoot; if (rootNr > 1) rootName += "-" + std::to_string(rootNr); if (i->first != "out") rootName += "-" + i->first; - outPath = addPermRoot(ref(store), outPath, rootName, indirectRoot); + outPath = addPermRoot(ref(store), outPath, rootName, indirectRoot); } outputs.insert(outPath); } @@ -100,7 +100,7 @@ static PathSet realisePath(Path path, bool build = true) Path rootName = gcRoot; rootNr++; if (rootNr > 1) rootName += "-" + std::to_string(rootNr); - path = addPermRoot(ref(store), path, rootName, indirectRoot); + path = addPermRoot(ref(store), path, rootName, indirectRoot); } return singleton(path); } @@ -142,7 +142,7 @@ static void opRealise(Strings opFlags, Strings opArgs) } if (settings.get("print-missing", true)) - printMissing(ref(store), willBuild, willSubstitute, unknown, downloadSize, narSize); + printMissing(ref(store), willBuild, willSubstitute, unknown, downloadSize, narSize); if (dryRun) return; diff --git a/src/nix-store/xmlgraph.cc b/src/nix-store/xmlgraph.cc index f88266bbb..ccb218408 100644 --- a/src/nix-store/xmlgraph.cc +++ b/src/nix-store/xmlgraph.cc @@ -33,7 +33,7 @@ static string makeNode(const string & id) } -void printXmlGraph(StoreAPI & store, const PathSet & roots) +void printXmlGraph(Store & store, const PathSet & roots) { PathSet workList(roots); PathSet doneSet; diff --git a/src/nix-store/xmlgraph.hh b/src/nix-store/xmlgraph.hh index 6d6d12a06..6454d3a28 100644 --- a/src/nix-store/xmlgraph.hh +++ b/src/nix-store/xmlgraph.hh @@ -4,8 +4,8 @@ namespace nix { -class StoreAPI; +class Store; -void printXmlGraph(StoreAPI & store, const PathSet & roots); +void printXmlGraph(Store & store, const PathSet & roots); }