forked from lix-project/lix
Provide default implementations for a couple of Store methods
This commit is contained in:
parent
ddb5577f2e
commit
fa07558a06
|
@ -71,9 +71,6 @@ public:
|
||||||
PathSet & referrers) override
|
PathSet & referrers) override
|
||||||
{ notImpl(); }
|
{ notImpl(); }
|
||||||
|
|
||||||
PathSet queryValidDerivers(const Path & path) override
|
|
||||||
{ return {}; }
|
|
||||||
|
|
||||||
PathSet queryDerivationOutputs(const Path & path) override
|
PathSet queryDerivationOutputs(const Path & path) override
|
||||||
{ notImpl(); }
|
{ notImpl(); }
|
||||||
|
|
||||||
|
@ -83,13 +80,6 @@ public:
|
||||||
Path queryPathFromHashPart(const string & hashPart) override
|
Path queryPathFromHashPart(const string & hashPart) override
|
||||||
{ notImpl(); }
|
{ notImpl(); }
|
||||||
|
|
||||||
PathSet querySubstitutablePaths(const PathSet & paths) override
|
|
||||||
{ return {}; }
|
|
||||||
|
|
||||||
void querySubstitutablePathInfos(const PathSet & paths,
|
|
||||||
SubstitutablePathInfos & infos) override
|
|
||||||
{ }
|
|
||||||
|
|
||||||
bool wantMassQuery() override { return wantMassQuery_; }
|
bool wantMassQuery() override { return wantMassQuery_; }
|
||||||
|
|
||||||
void addToStore(const ValidPathInfo & info, const ref<std::string> & nar,
|
void addToStore(const ValidPathInfo & info, const ref<std::string> & nar,
|
||||||
|
@ -121,21 +111,12 @@ public:
|
||||||
void addIndirectRoot(const Path & path) override
|
void addIndirectRoot(const Path & path) override
|
||||||
{ notImpl(); }
|
{ notImpl(); }
|
||||||
|
|
||||||
void syncWithGC() override
|
|
||||||
{ }
|
|
||||||
|
|
||||||
Roots findRoots() override
|
Roots findRoots() override
|
||||||
{ notImpl(); }
|
{ notImpl(); }
|
||||||
|
|
||||||
void collectGarbage(const GCOptions & options, GCResults & results) override
|
void collectGarbage(const GCOptions & options, GCResults & results) override
|
||||||
{ notImpl(); }
|
{ notImpl(); }
|
||||||
|
|
||||||
void optimiseStore() override
|
|
||||||
{ }
|
|
||||||
|
|
||||||
bool verifyStore(bool checkContents, bool repair) override
|
|
||||||
{ return true; }
|
|
||||||
|
|
||||||
ref<FSAccessor> getFSAccessor() override;
|
ref<FSAccessor> getFSAccessor() override;
|
||||||
|
|
||||||
void addSignatures(const Path & storePath, const StringSet & sigs) override
|
void addSignatures(const Path & storePath, const StringSet & sigs) override
|
||||||
|
|
|
@ -285,6 +285,19 @@ bool Store::isValidPath(const Path & storePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Default implementation for stores that only implement
|
||||||
|
queryPathInfoUncached(). */
|
||||||
|
bool Store::isValidPathUncached(const Path & path)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
queryPathInfo(path);
|
||||||
|
return true;
|
||||||
|
} catch (InvalidPath &) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ref<const ValidPathInfo> Store::queryPathInfo(const Path & storePath)
|
ref<const ValidPathInfo> Store::queryPathInfo(const Path & storePath)
|
||||||
{
|
{
|
||||||
std::promise<ref<ValidPathInfo>> promise;
|
std::promise<ref<ValidPathInfo>> promise;
|
||||||
|
|
|
@ -320,7 +320,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual bool isValidPathUncached(const Path & path) = 0;
|
virtual bool isValidPathUncached(const Path & path);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ public:
|
||||||
output. (Note that the result of `queryDeriver()' is the
|
output. (Note that the result of `queryDeriver()' is the
|
||||||
derivation that was actually used to produce `path', which may
|
derivation that was actually used to produce `path', which may
|
||||||
not exist anymore.) */
|
not exist anymore.) */
|
||||||
virtual PathSet queryValidDerivers(const Path & path) = 0;
|
virtual PathSet queryValidDerivers(const Path & path) { return {}; };
|
||||||
|
|
||||||
/* Query the outputs of the derivation denoted by `path'. */
|
/* Query the outputs of the derivation denoted by `path'. */
|
||||||
virtual PathSet queryDerivationOutputs(const Path & path) = 0;
|
virtual PathSet queryDerivationOutputs(const Path & path) = 0;
|
||||||
|
@ -373,13 +373,13 @@ public:
|
||||||
virtual Path queryPathFromHashPart(const string & hashPart) = 0;
|
virtual Path queryPathFromHashPart(const string & hashPart) = 0;
|
||||||
|
|
||||||
/* Query which of the given paths have substitutes. */
|
/* Query which of the given paths have substitutes. */
|
||||||
virtual PathSet querySubstitutablePaths(const PathSet & paths) = 0;
|
virtual PathSet querySubstitutablePaths(const PathSet & paths) { return {}; };
|
||||||
|
|
||||||
/* Query substitute info (i.e. references, derivers and download
|
/* Query substitute info (i.e. references, derivers and download
|
||||||
sizes) of a set of paths. If a path does not have substitute
|
sizes) of a set of paths. If a path does not have substitute
|
||||||
info, it's omitted from the resulting ‘infos’ map. */
|
info, it's omitted from the resulting ‘infos’ map. */
|
||||||
virtual void querySubstitutablePathInfos(const PathSet & paths,
|
virtual void querySubstitutablePathInfos(const PathSet & paths,
|
||||||
SubstitutablePathInfos & infos) = 0;
|
SubstitutablePathInfos & infos) { return; };
|
||||||
|
|
||||||
virtual bool wantMassQuery() { return false; }
|
virtual bool wantMassQuery() { return false; }
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ public:
|
||||||
permanent root and sees our's.
|
permanent root and sees our's.
|
||||||
|
|
||||||
In either case the permanent root is seen by the collector. */
|
In either case the permanent root is seen by the collector. */
|
||||||
virtual void syncWithGC() = 0;
|
virtual void syncWithGC() { };
|
||||||
|
|
||||||
/* Find the roots of the garbage collector. Each root is a pair
|
/* Find the roots of the garbage collector. Each root is a pair
|
||||||
(link, storepath) where `link' is the path of the symlink
|
(link, storepath) where `link' is the path of the symlink
|
||||||
|
@ -485,11 +485,11 @@ public:
|
||||||
|
|
||||||
/* Optimise the disk space usage of the Nix store by hard-linking files
|
/* Optimise the disk space usage of the Nix store by hard-linking files
|
||||||
with the same contents. */
|
with the same contents. */
|
||||||
virtual void optimiseStore() = 0;
|
virtual void optimiseStore() { };
|
||||||
|
|
||||||
/* Check the integrity of the Nix store. Returns true if errors
|
/* Check the integrity of the Nix store. Returns true if errors
|
||||||
remain. */
|
remain. */
|
||||||
virtual bool verifyStore(bool checkContents, bool repair) = 0;
|
virtual bool verifyStore(bool checkContents, bool repair) { return false; };
|
||||||
|
|
||||||
/* Return an object to access files in the Nix store. */
|
/* Return an object to access files in the Nix store. */
|
||||||
virtual ref<FSAccessor> getFSAccessor() = 0;
|
virtual ref<FSAccessor> getFSAccessor() = 0;
|
||||||
|
|
Loading…
Reference in a new issue