Support repairPath on most stores.

More progress on issue #5729

The method trivially generalizes to be store-implementation-agnostic, in
fact.

However, we force it to continue to be unimplemented with `RemoteStore`
and `LegacySSHStore` because the implementation we'd get via the
generalization is probably not the one users expect. This keeps our
hands untied to do it right going forward.

For more about the tension between the scheduler logic being
store-type-agnostic and remote stores doing their own scheduling, see
issues #5025 and #5056.
This commit is contained in:
John Ericson 2023-04-13 10:38:35 -04:00
parent f5ab38a688
commit a6f85e052c
5 changed files with 24 additions and 5 deletions

View file

@ -119,7 +119,7 @@ void Store::ensurePath(const StorePath & path)
} }
void LocalStore::repairPath(const StorePath & path) void Store::repairPath(const StorePath & path)
{ {
Worker worker(*this, *this); Worker worker(*this, *this);
GoalPtr goal = worker.makePathSubstitutionGoal(path, Repair); GoalPtr goal = worker.makePathSubstitutionGoal(path, Repair);

View file

@ -345,6 +345,17 @@ public:
virtual ref<FSAccessor> getFSAccessor() override virtual ref<FSAccessor> getFSAccessor() override
{ unsupported("getFSAccessor"); } { unsupported("getFSAccessor"); }
/**
* The default instance would schedule the work on the client side, but
* for consistency with `buildPaths` and `buildDerivation` it should happen
* on the remote side.
*
* We make this fail for now so we can add implement this properly later
* without it being a breaking change.
*/
void repairPath(const StorePath & path) override
{ unsupported("repairPath"); }
void computeFSClosure(const StorePathSet & paths, void computeFSClosure(const StorePathSet & paths,
StorePathSet & out, bool flipDirection = false, StorePathSet & out, bool flipDirection = false,
bool includeOutputs = false, bool includeDerivers = false) override bool includeOutputs = false, bool includeDerivers = false) override

View file

@ -240,8 +240,6 @@ public:
void vacuumDB(); void vacuumDB();
void repairPath(const StorePath & path) override;
void addSignatures(const StorePath & storePath, const StringSet & sigs) override; void addSignatures(const StorePath & storePath, const StringSet & sigs) override;
/** /**

View file

@ -136,6 +136,17 @@ public:
bool verifyStore(bool checkContents, RepairFlag repair) override; bool verifyStore(bool checkContents, RepairFlag repair) override;
/**
* The default instance would schedule the work on the client side, but
* for consistency with `buildPaths` and `buildDerivation` it should happen
* on the remote side.
*
* We make this fail for now so we can add implement this properly later
* without it being a breaking change.
*/
void repairPath(const StorePath & path) override
{ unsupported("repairPath"); }
void addSignatures(const StorePath & storePath, const StringSet & sigs) override; void addSignatures(const StorePath & storePath, const StringSet & sigs) override;
void queryMissing(const std::vector<DerivedPath> & targets, void queryMissing(const std::vector<DerivedPath> & targets,

View file

@ -684,8 +684,7 @@ public:
* Repair the contents of the given path by redownloading it using * Repair the contents of the given path by redownloading it using
* a substituter (if available). * a substituter (if available).
*/ */
virtual void repairPath(const StorePath & path) virtual void repairPath(const StorePath & path);
{ unsupported("repairPath"); }
/** /**
* Add signatures to the specified store path. The signatures are * Add signatures to the specified store path. The signatures are