mirror of
https://github.com/NixOS/nix.git
synced 2025-11-13 14:02:42 +01:00
Starts progress on #5729. The idea is that we should not have these default methods throwing "unimplemented". This is a small step in that direction. I kept `addTempRoot` because it is a no-op, rather than failure. Also, as a practical matter, it is called all over the place, while doing other tasks, so the downcasting would be annoying. Maybe in the future I could move the "real" `addTempRoot` to `GcStore`, and the existing usecases use a `tryAddTempRoot` wrapper to downcast or do nothing, but I wasn't sure whether that was a good idea so with a bias to less churn I didn't do it yet.
13 lines
257 B
C++
13 lines
257 B
C++
#include "gc-store.hh"
|
|
|
|
namespace nix {
|
|
|
|
GcStore & requireGcStore(Store & store)
|
|
{
|
|
auto * gcStore = dynamic_cast<GcStore *>(&store);
|
|
if (!gcStore)
|
|
throw UsageError("Garbage collection not supported by this store");
|
|
return *gcStore;
|
|
}
|
|
|
|
}
|