Skip to content

Commit

Permalink
Expose schedule entrypoints to all stores
Browse files Browse the repository at this point in the history
Remote stores still override so the other end schedules.
  • Loading branch information
Ericson2314 committed Dec 23, 2020
1 parent 450c350 commit 85f2e9e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 52 deletions.
7 changes: 0 additions & 7 deletions src/libstore/binary-cache-store.hh
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,6 @@ public:

void narFromPath(const StorePath & path, Sink & sink) override;

BuildResult buildDerivation(const StorePath & drvPath, const BasicDerivation & drv,
BuildMode buildMode) override
{ unsupported("buildDerivation"); }

void ensurePath(const StorePath & path) override
{ unsupported("ensurePath"); }

ref<FSAccessor> getFSAccessor() override;

void addSignatures(const StorePath & storePath, const StringSet & sigs) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace nix {

void LocalStore::buildPaths(const std::vector<StorePathWithOutputs> & drvPaths, BuildMode buildMode)
void Store::buildPaths(const std::vector<StorePathWithOutputs> & drvPaths, BuildMode buildMode)
{
Worker worker(*this);

Expand Down Expand Up @@ -43,7 +43,7 @@ void LocalStore::buildPaths(const std::vector<StorePathWithOutputs> & drvPaths,
}
}

BuildResult LocalStore::buildDerivation(const StorePath & drvPath, const BasicDerivation & drv,
BuildResult Store::buildDerivation(const StorePath & drvPath, const BasicDerivation & drv,
BuildMode buildMode)
{
Worker worker(*this);
Expand All @@ -63,7 +63,7 @@ BuildResult LocalStore::buildDerivation(const StorePath & drvPath, const BasicDe
}


void LocalStore::ensurePath(const StorePath & path)
void Store::ensurePath(const StorePath & path)
{
/* If the path is already valid, we're done. */
if (isValidPath(path)) return;
Expand Down
7 changes: 0 additions & 7 deletions src/libstore/dummy-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ struct DummyStore : public virtual DummyStoreConfig, public virtual Store
void narFromPath(const StorePath & path, Sink & sink) override
{ unsupported("narFromPath"); }

void ensurePath(const StorePath & path) override
{ unsupported("ensurePath"); }

BuildResult buildDerivation(const StorePath & drvPath, const BasicDerivation & drv,
BuildMode buildMode) override
{ unsupported("buildDerivation"); }

std::optional<const Realisation> queryRealisation(const DrvOutput&) override
{ unsupported("queryRealisation"); }
};
Expand Down
9 changes: 0 additions & 9 deletions src/libstore/local-store.hh
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,6 @@ public:
StorePath addTextToStore(const string & name, const string & s,
const StorePathSet & references, RepairFlag repair) override;

void buildPaths(
const std::vector<StorePathWithOutputs> & paths,
BuildMode buildMode) override;

BuildResult buildDerivation(const StorePath & drvPath, const BasicDerivation & drv,
BuildMode buildMode) override;

void ensurePath(const StorePath & path) override;

void addTempRoot(const StorePath & path) override;

void addIndirectRoot(const Path & path) override;
Expand Down
23 changes: 0 additions & 23 deletions src/libstore/store-api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -747,29 +747,6 @@ const Store::Stats & Store::getStats()
}


void Store::buildPaths(const std::vector<StorePathWithOutputs> & paths, BuildMode buildMode)
{
StorePathSet paths2;

for (auto & path : paths) {
if (path.path.isDerivation()) {
auto outPaths = queryPartialDerivationOutputMap(path.path);
for (auto & outputName : path.outputs) {
auto currentOutputPathIter = outPaths.find(outputName);
if (currentOutputPathIter == outPaths.end() ||
!currentOutputPathIter->second ||
!isValidPath(*currentOutputPathIter->second))
unsupported("buildPaths");
}
} else
paths2.insert(path.path);
}

if (queryValidPaths(paths2).size() != paths2.size())
unsupported("buildPaths");
}


void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
const StorePath & storePath, RepairFlag repair, CheckSigsFlag checkSigs)
{
Expand Down
6 changes: 3 additions & 3 deletions src/libstore/store-api.hh
Original file line number Diff line number Diff line change
Expand Up @@ -523,17 +523,17 @@ public:
explicitly choosing to allow it).
*/
virtual BuildResult buildDerivation(const StorePath & drvPath, const BasicDerivation & drv,
BuildMode buildMode = bmNormal) = 0;
BuildMode buildMode = bmNormal);

/* Ensure that a path is valid. If it is not currently valid, it
may be made valid by running a substitute (if defined for the
path). */
virtual void ensurePath(const StorePath & path) = 0;
virtual void ensurePath(const StorePath & path);

/* Add a store path as a temporary root of the garbage collector.
The root disappears as soon as we exit. */
virtual void addTempRoot(const StorePath & path)
{ unsupported("addTempRoot"); }
{ warn("not creating temp root, store doesn't support GC"); }

/* Add an indirect root, which is merely a symlink to `path' from
/nix/var/nix/gcroots/auto/<hash of `path'>. `path' is supposed
Expand Down

0 comments on commit 85f2e9e

Please sign in to comment.