feat(provenance,daemon): add Ed25519 signing primitives and bounded daemon describe op
This commit is contained in:
1 parent
0bde74f739
commit
21babb8c31
16 files changed
+1232
-20
No files matched your search
+19
-1
@@ -38,6 +38,7 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <charconv>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
@@ -1535,6 +1536,7 @@ struct DaemonCmdOptions {
|
||||
std::string project_arg;
|
||||
std::optional<std::string> build_arg;
|
||||
std::optional<std::string> socket_arg;
|
||||
std::string profile_arg{"debug"};
|
||||
std::string max_bytes_arg{"0"};
|
||||
std::string max_requests_arg{"0"};
|
||||
};
|
||||
@@ -1607,12 +1609,23 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
|
||||
return 2;
|
||||
}
|
||||
request_json = std::format(R"({{"op":"gc","max_bytes":{}}})", max_bytes);
|
||||
} else if (sub == "describe") {
|
||||
if (opts.profile_arg.empty()) {
|
||||
std::cerr << "vbs daemon describe: --profile must not be empty\n";
|
||||
return 2;
|
||||
}
|
||||
request_json =
|
||||
std::format(R"({{"op":"describe","profile":{}}})", Util::json_quote(opts.profile_arg));
|
||||
} else {
|
||||
std::cerr << "vbs daemon: unknown command '" << sub << "'\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
auto response = Daemon::request(socket_path, request_json);
|
||||
// Describe evaluates the whole project graph (descriptor compile, toolchain probe, lowering),
|
||||
// which can exceed the 2 s default; the daemon bounds evaluation at 10 s.
|
||||
const auto request_timeout =
|
||||
sub == "describe" ? std::chrono::milliseconds{15000} : std::chrono::milliseconds{2000};
|
||||
auto response = Daemon::request(socket_path, request_json, request_timeout);
|
||||
if (!response) {
|
||||
std::cerr << "vbs daemon: " << response.error().message() << '\n';
|
||||
return 1;
|
||||
@@ -2534,6 +2547,11 @@ int main(int argc, char **argv) {
|
||||
daemon_gc_cmd.option_default("--max-bytes", "",
|
||||
"Target maximum retained CAS bytes (0=unreferenced only)",
|
||||
daemon_opts.max_bytes_arg, "0");
|
||||
auto &daemon_describe_cmd =
|
||||
daemon_cmd.subcommand("describe", "Describe a project's build graph via the daemon");
|
||||
configure_daemon_common(daemon_describe_cmd);
|
||||
daemon_describe_cmd.option_default("--profile", "-p", "Profile to evaluate",
|
||||
daemon_opts.profile_arg, "debug");
|
||||
|
||||
const auto parsed = root.parse_detailed(argc, argv);
|
||||
if (parsed.is_help()) {
|
||||
|
||||
Reference in new issue
Block a user