mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-13 01:36:15 +02:00
Remove syncWithGC()
This commit is contained in:
parent
8eac7dfad4
commit
9947f1646a
6 changed files with 7 additions and 45 deletions
|
@ -624,9 +624,9 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Obsolete.
|
||||||
case wopSyncWithGC: {
|
case wopSyncWithGC: {
|
||||||
logger->startWork();
|
logger->startWork();
|
||||||
store->syncWithGC();
|
|
||||||
logger->stopWork();
|
logger->stopWork();
|
||||||
to << 1;
|
to << 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -71,12 +71,6 @@ static void makeSymlink(const Path & link, const Path & target)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LocalStore::syncWithGC()
|
|
||||||
{
|
|
||||||
AutoCloseFD fdGCLock = openGCLock(ltRead);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LocalStore::addIndirectRoot(const Path & path)
|
void LocalStore::addIndirectRoot(const Path & path)
|
||||||
{
|
{
|
||||||
string hash = hashString(htSHA1, path).to_string(Base32, false);
|
string hash = hashString(htSHA1, path).to_string(Base32, false);
|
||||||
|
@ -95,6 +89,12 @@ Path LocalFSStore::addPermRoot(const StorePath & storePath, const Path & _gcRoot
|
||||||
"creating a garbage collector root (%1%) in the Nix store is forbidden "
|
"creating a garbage collector root (%1%) in the Nix store is forbidden "
|
||||||
"(are you running nix-build inside the store?)", gcRoot);
|
"(are you running nix-build inside the store?)", gcRoot);
|
||||||
|
|
||||||
|
/* Register this root with the garbage collector, if it's
|
||||||
|
running. This should be superfluous since the caller should
|
||||||
|
have registered this root yet, but let's be on the safe
|
||||||
|
side. */
|
||||||
|
addTempRoot(storePath);
|
||||||
|
|
||||||
/* Don't clobber the link if it already exists and doesn't
|
/* Don't clobber the link if it already exists and doesn't
|
||||||
point to the Nix store. */
|
point to the Nix store. */
|
||||||
if (pathExists(gcRoot) && (!isLink(gcRoot) || !isInStore(readLink(gcRoot))))
|
if (pathExists(gcRoot) && (!isLink(gcRoot) || !isInStore(readLink(gcRoot))))
|
||||||
|
@ -102,11 +102,6 @@ Path LocalFSStore::addPermRoot(const StorePath & storePath, const Path & _gcRoot
|
||||||
makeSymlink(gcRoot, printStorePath(storePath));
|
makeSymlink(gcRoot, printStorePath(storePath));
|
||||||
addIndirectRoot(gcRoot);
|
addIndirectRoot(gcRoot);
|
||||||
|
|
||||||
/* Grab the global GC root, causing us to block while a GC is in
|
|
||||||
progress. This prevents the set of permanent roots from
|
|
||||||
increasing while a GC is in progress. */
|
|
||||||
syncWithGC();
|
|
||||||
|
|
||||||
return gcRoot;
|
return gcRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,8 +148,6 @@ public:
|
||||||
|
|
||||||
void addIndirectRoot(const Path & path) override;
|
void addIndirectRoot(const Path & path) override;
|
||||||
|
|
||||||
void syncWithGC() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef std::shared_ptr<AutoCloseFD> FDPtr;
|
typedef std::shared_ptr<AutoCloseFD> FDPtr;
|
||||||
|
|
|
@ -797,15 +797,6 @@ void RemoteStore::addIndirectRoot(const Path & path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RemoteStore::syncWithGC()
|
|
||||||
{
|
|
||||||
auto conn(getConnection());
|
|
||||||
conn->to << wopSyncWithGC;
|
|
||||||
conn.processStderr();
|
|
||||||
readInt(conn->from);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Roots RemoteStore::findRoots(bool censor)
|
Roots RemoteStore::findRoots(bool censor)
|
||||||
{
|
{
|
||||||
auto conn(getConnection());
|
auto conn(getConnection());
|
||||||
|
|
|
@ -101,8 +101,6 @@ public:
|
||||||
|
|
||||||
void addIndirectRoot(const Path & path) override;
|
void addIndirectRoot(const Path & path) override;
|
||||||
|
|
||||||
void syncWithGC() override;
|
|
||||||
|
|
||||||
Roots findRoots(bool censor) override;
|
Roots findRoots(bool censor) override;
|
||||||
|
|
||||||
void collectGarbage(const GCOptions & options, GCResults & results) override;
|
void collectGarbage(const GCOptions & options, GCResults & results) override;
|
||||||
|
|
|
@ -561,26 +561,6 @@ public:
|
||||||
virtual void addIndirectRoot(const Path & path)
|
virtual void addIndirectRoot(const Path & path)
|
||||||
{ unsupported("addIndirectRoot"); }
|
{ unsupported("addIndirectRoot"); }
|
||||||
|
|
||||||
/* Acquire the global GC lock, then immediately release it. This
|
|
||||||
function must be called after registering a new permanent root,
|
|
||||||
but before exiting. Otherwise, it is possible that a running
|
|
||||||
garbage collector doesn't see the new root and deletes the
|
|
||||||
stuff we've just built. By acquiring the lock briefly, we
|
|
||||||
ensure that either:
|
|
||||||
|
|
||||||
- The collector is already running, and so we block until the
|
|
||||||
collector is finished. The collector will know about our
|
|
||||||
*temporary* locks, which should include whatever it is we
|
|
||||||
want to register as a permanent lock.
|
|
||||||
|
|
||||||
- The collector isn't running, or it's just started but hasn't
|
|
||||||
acquired the GC lock yet. In that case we get and release
|
|
||||||
the lock right away, then exit. The collector scans the
|
|
||||||
permanent root and sees ours.
|
|
||||||
|
|
||||||
In either case the permanent root is seen by the collector. */
|
|
||||||
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
|
||||||
outside of the Nix store that point to `storePath'. If
|
outside of the Nix store that point to `storePath'. If
|
||||||
|
|
Loading…
Reference in a new issue