diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2022-03-08 17:45:19 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2022-03-11 13:27:38 +0000 |
commit | 073e134de6260de7d90b135b7e173157741d4853 (patch) | |
tree | f35f9491e2da62f14caedf00ea9e174eabd8e924 /src | |
parent | aee56e0f895e7b9890d1ec948b24c75478f9e88e (diff) |
Rename `requireGcStore` to `GcStore::require`
I should have done this to begin with. This will be nicer once more
Store sub-interfaces exist too, to illustrate the pattern.
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/daemon.cc | 6 | ||||
-rw-r--r-- | src/libstore/gc-store.cc | 2 | ||||
-rw-r--r-- | src/libstore/gc-store.hh | 4 | ||||
-rw-r--r-- | src/nix-collect-garbage/nix-collect-garbage.cc | 2 | ||||
-rw-r--r-- | src/nix-store/nix-store.cc | 6 | ||||
-rw-r--r-- | src/nix/store-delete.cc | 2 | ||||
-rw-r--r-- | src/nix/store-gc.cc | 2 |
7 files changed, 12 insertions, 12 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc index e6760664c..ffc605410 100644 --- a/src/libstore/daemon.cc +++ b/src/libstore/daemon.cc @@ -645,7 +645,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, Path path = absPath(readString(from)); logger->startWork(); - auto & gcStore = requireGcStore(*store); + auto & gcStore = GcStore::require(*store); gcStore.addIndirectRoot(path); logger->stopWork(); @@ -663,7 +663,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, case wopFindRoots: { logger->startWork(); - auto & gcStore = requireGcStore(*store); + auto & gcStore = GcStore::require(*store); Roots roots = gcStore.findRoots(!trusted); logger->stopWork(); @@ -695,7 +695,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, logger->startWork(); if (options.ignoreLiveness) throw Error("you are not allowed to ignore liveness"); - auto & gcStore = requireGcStore(*store); + auto & gcStore = GcStore::require(*store); gcStore.collectGarbage(options, results); logger->stopWork(); diff --git a/src/libstore/gc-store.cc b/src/libstore/gc-store.cc index 3dbdec53b..4516cc744 100644 --- a/src/libstore/gc-store.cc +++ b/src/libstore/gc-store.cc @@ -2,7 +2,7 @@ namespace nix { -GcStore & requireGcStore(Store & store) +GcStore & GcStore::require(Store & store) { auto * gcStore = dynamic_cast<GcStore *>(&store); if (!gcStore) diff --git a/src/libstore/gc-store.hh b/src/libstore/gc-store.hh index 829f70dc4..462cc097b 100644 --- a/src/libstore/gc-store.hh +++ b/src/libstore/gc-store.hh @@ -77,8 +77,8 @@ struct GcStore : public virtual Store /* Perform a garbage collection. */ virtual void collectGarbage(const GCOptions & options, GCResults & results) = 0; -}; -GcStore & requireGcStore(Store & store); + static GcStore & require(Store & store); +}; } diff --git a/src/nix-collect-garbage/nix-collect-garbage.cc b/src/nix-collect-garbage/nix-collect-garbage.cc index 4b28ea6a4..b61f0e640 100644 --- a/src/nix-collect-garbage/nix-collect-garbage.cc +++ b/src/nix-collect-garbage/nix-collect-garbage.cc @@ -81,7 +81,7 @@ static int main_nix_collect_garbage(int argc, char * * argv) // Run the actual garbage collector. if (!dryRun) { auto store = openStore(); - auto & gcStore = requireGcStore(*store); + auto & gcStore = GcStore::require(*store); options.action = GCOptions::gcDeleteDead; GCResults results; PrintFreed freed(true, results); diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 8ebaf9387..33493500c 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -429,7 +429,7 @@ static void opQuery(Strings opFlags, Strings opArgs) store->computeFSClosure( args, referrers, true, settings.gcKeepOutputs, settings.gcKeepDerivations); - auto & gcStore = requireGcStore(*store); + auto & gcStore = GcStore::require(*store); Roots roots = gcStore.findRoots(false); for (auto & [target, links] : roots) if (referrers.find(target) != referrers.end()) @@ -590,7 +590,7 @@ static void opGC(Strings opFlags, Strings opArgs) if (!opArgs.empty()) throw UsageError("no arguments expected"); - auto & gcStore = requireGcStore(*store); + auto & gcStore = GcStore::require(*store); if (printRoots) { Roots roots = gcStore.findRoots(false); @@ -629,7 +629,7 @@ static void opDelete(Strings opFlags, Strings opArgs) for (auto & i : opArgs) options.pathsToDelete.insert(store->followLinksToStorePath(i)); - auto & gcStore = requireGcStore(*store); + auto & gcStore = GcStore::require(*store); GCResults results; PrintFreed freed(true, results); diff --git a/src/nix/store-delete.cc b/src/nix/store-delete.cc index aa7a8b12f..0de7efaba 100644 --- a/src/nix/store-delete.cc +++ b/src/nix/store-delete.cc @@ -33,7 +33,7 @@ struct CmdStoreDelete : StorePathsCommand void run(ref<Store> store, std::vector<StorePath> && storePaths) override { - auto & gcStore = requireGcStore(*store); + auto & gcStore = GcStore::require(*store); for (auto & path : storePaths) options.pathsToDelete.insert(path); diff --git a/src/nix/store-gc.cc b/src/nix/store-gc.cc index 21718dc0c..515f4ffdb 100644 --- a/src/nix/store-gc.cc +++ b/src/nix/store-gc.cc @@ -34,7 +34,7 @@ struct CmdStoreGC : StoreCommand, MixDryRun void run(ref<Store> store) override { - auto & gcStore = requireGcStore(*store); + auto & gcStore = GcStore::require(*store); options.action = dryRun ? GCOptions::gcReturnDead : GCOptions::gcDeleteDead; GCResults results; |