feat(3p/nix): Implement FindRoots, CollectGarbage
Implement the RPC client and server handlers for the FindRoots and CollectGarbage RPC calls Change-Id: Ifa5d582c6a33bd1e7661ac2fc860505ef404dad0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1656 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
This commit is contained in:
parent
f9df9b4733
commit
ea488b5705
5 changed files with 117 additions and 3 deletions
29
third_party/nix/src/libstore/store-api.cc
vendored
29
third_party/nix/src/libstore/store-api.cc
vendored
|
|
@ -77,6 +77,35 @@ nix::proto::BuildStatus BuildResult::status_to_proto() {
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<GCOptions::GCAction> GCActionFromProto(
|
||||
nix::proto::GCAction gc_action) {
|
||||
switch (gc_action) {
|
||||
case nix::proto::GCAction::ReturnLive:
|
||||
return GCOptions::GCAction::gcReturnLive;
|
||||
case nix::proto::GCAction::ReturnDead:
|
||||
return GCOptions::GCAction::gcReturnDead;
|
||||
case nix::proto::GCAction::DeleteDead:
|
||||
return GCOptions::GCAction::gcDeleteDead;
|
||||
case nix::proto::GCAction::DeleteSpecific:
|
||||
return GCOptions::GCAction::gcDeleteSpecific;
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] const proto::GCAction GCOptions::ActionToProto() const {
|
||||
switch (action) {
|
||||
case GCOptions::GCAction::gcReturnLive:
|
||||
return nix::proto::GCAction::ReturnLive;
|
||||
case GCOptions::GCAction::gcReturnDead:
|
||||
return nix::proto::GCAction::ReturnDead;
|
||||
case GCOptions::GCAction::gcDeleteDead:
|
||||
return nix::proto::GCAction::DeleteDead;
|
||||
case GCOptions::GCAction::gcDeleteSpecific:
|
||||
return nix::proto::GCAction::DeleteSpecific;
|
||||
}
|
||||
}
|
||||
|
||||
bool Store::isInStore(const Path& path) const {
|
||||
return isInDir(path, storeDir);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue