aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-04-04 09:42:50 +0200
committerStefan Boberg <[email protected]>2023-04-04 09:44:24 +0200
commit79eb43a26f6600b7c3668d58ae45169b76beef76 (patch)
treeccd3ca17fce35f59e3388cd6c58c98f6c08120ed
parentminor ZenCmdBase cleanup (diff)
parent#minor - don't log "sentry initialized" if sentry is explicitly disabled. (diff)
downloadzen-79eb43a26f6600b7c3668d58ae45169b76beef76.tar.xz
zen-79eb43a26f6600b7c3668d58ae45169b76beef76.zip
merge
-rw-r--r--.gitignore2
-rw-r--r--zen/cmds/cache.cpp4
-rw-r--r--zen/zen.cpp65
-rw-r--r--zenserver/zenserver.cpp15
4 files changed, 48 insertions, 38 deletions
diff --git a/.gitignore b/.gitignore
index 07360f5a2..7fe7d21b6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -228,6 +228,8 @@ tags
# generated build files
makefile
/vsxmake*/
+CMakefiles/
+CMake*
# ClangD cache directory
.cache
diff --git a/zen/cmds/cache.cpp b/zen/cmds/cache.cpp
index 2407f5f55..b9e10cbf8 100644
--- a/zen/cmds/cache.cpp
+++ b/zen/cmds/cache.cpp
@@ -17,7 +17,7 @@ DropCommand::DropCommand()
{
m_Options.add_options()("h,help", "Print help");
m_Options.add_option("", "u", "hosturl", "Host URL", cxxopts::value(m_HostName)->default_value("http://localhost:1337"), "<hosturl>");
- m_Options.add_option("", "n", "namespace", "Namnspace name", cxxopts::value(m_NamespaceName), "<namespacename>");
+ m_Options.add_option("", "n", "namespace", "Namespace name", cxxopts::value(m_NamespaceName), "<namespacename>");
m_Options.add_option("", "b", "bucket", "Bucket name", cxxopts::value(m_BucketName), "<bucketname>");
m_Options.parse_positional({"namespace", "bucket"});
}
@@ -76,7 +76,7 @@ CacheInfoCommand::CacheInfoCommand()
{
m_Options.add_options()("h,help", "Print help");
m_Options.add_option("", "u", "hosturl", "Host URL", cxxopts::value(m_HostName)->default_value("http://localhost:1337"), "<hosturl>");
- m_Options.add_option("", "n", "namespace", "Namnspace name", cxxopts::value(m_NamespaceName), "<namespacename>");
+ m_Options.add_option("", "n", "namespace", "Namespace name", cxxopts::value(m_NamespaceName), "<namespacename>");
m_Options.add_option("", "b", "bucket", "Bucket name", cxxopts::value(m_BucketName), "<bucketname>");
m_Options.parse_positional({"namespace", "bucket"});
}
diff --git a/zen/zen.cpp b/zen/zen.cpp
index 8252d8868..e72619fdc 100644
--- a/zen/zen.cpp
+++ b/zen/zen.cpp
@@ -47,11 +47,13 @@ ZenCmdBase::ParseOptions(int argc, char** argv)
{
cxxopts::Options& CmdOptions = Options();
cxxopts::ParseResult Result = CmdOptions.parse(argc, argv);
+
if (Result.count("help"))
{
printf("%s\n", CmdOptions.help().c_str());
return false;
}
+
if (!Result.unmatched().empty())
{
zen::ExtendableStringBuilder<64> StringBuilder;
@@ -66,6 +68,7 @@ ZenCmdBase::ParseOptions(int argc, char** argv)
StringBuilder.Append('"');
First = false;
}
+
throw cxxopts::OptionParseException(fmt::format("Invalid arguments: {}", StringBuilder.ToView()));
}
@@ -112,6 +115,7 @@ ZenCmdBase::FormatHttpResponse(const cpr::Response& Response)
{
return std::string(ResponseString);
}
+
return fmt::format("{}: {}", ResponseString, Content);
}
@@ -184,30 +188,30 @@ main(int argc, char** argv)
auto _ = zen::MakeGuard([] { spdlog::shutdown(); });
- HashCommand HashCmd;
+ CacheInfoCommand CacheInfoCmd;
CopyCommand CopyCmd;
+ CreateOplogCommand CreateOplogCmd;
+ CreateProjectCommand CreateProjectCmd;
DedupCommand DedupCmd;
- DropCommand DropCmd;
- StatusCommand StatusCmd;
- TopCommand TopCmd;
- PrintCommand PrintCmd;
- PrintPackageCommand PrintPkgCmd;
- PsCommand PsCmd;
- UpCommand UpCmd;
DownCommand DownCmd;
- ExportOplogCommand ExportOplogCmd;
- ImportOplogCommand ImportOplogCmd;
- VersionCommand VersionCmd;
- CacheInfoCommand CacheInfoCmd;
+ DropCommand DropCmd;
DropProjectCommand ProjectDropCmd;
- ProjectInfoCommand ProjectInfoCmd;
- CreateProjectCommand CreateProjectCmd;
- CreateOplogCommand CreateOplogCmd;
+ ExportOplogCommand ExportOplogCmd;
GcCommand GcCmd;
GcStatusCommand GcStatusCmd;
+ HashCommand HashCmd;
+ ImportOplogCommand ImportOplogCmd;
+ PrintCommand PrintCmd;
+ PrintPackageCommand PrintPkgCmd;
+ ProjectInfoCommand ProjectInfoCmd;
+ PsCommand PsCmd;
RpcReplayCommand RpcReplayCmd;
RpcStartRecordingCommand RpcStartRecordingCmd;
RpcStopRecordingCommand RpcStopRecordingCmd;
+ StatusCommand StatusCmd;
+ TopCommand TopCmd;
+ UpCommand UpCmd;
+ VersionCommand VersionCmd;
#if ZEN_WITH_TESTS
RunTestsCommand RunTestsCmd;
@@ -221,30 +225,30 @@ main(int argc, char** argv)
} Commands[] = {
// clang-format off
// {"chunk", &ChunkCmd, "Perform chunking"},
+ {"cache-info", &CacheInfoCmd, "Info on cache, namespace or bucket"},
{"copy", &CopyCmd, "Copy file(s)"},
{"dedup", &DedupCmd, "Dedup files"},
+ {"down", &DownCmd, "Bring zen server down"},
{"drop", &DropCmd, "Drop cache namespace or bucket"},
+ {"gc-status", &GcStatusCmd, "Garbage collect zen storage status check"},
+ {"gc", &GcCmd, "Garbage collect zen storage"},
{"hash", &HashCmd, "Compute file hashes"},
+ {"oplog-create", &CreateOplogCmd, "Create a project oplog"},
+ {"oplog-export", &ExportOplogCmd, "Export project store oplog"},
+ {"oplog-import", &ImportOplogCmd, "Import project store oplog"},
{"print", &PrintCmd, "Print compact binary object"},
{"printpackage", &PrintPkgCmd, "Print compact binary package"},
- {"status", &StatusCmd, "Show zen status"},
- {"ps", &PsCmd, "Enumerate running zen server instances"},
- {"top", &TopCmd, "Monitor zen server activity"},
- {"up", &UpCmd, "Bring zen server up"},
- {"down", &DownCmd, "Bring zen server down"},
- {"version", &VersionCmd, "Get zen server version"},
- {"cache-info", &CacheInfoCmd, "Info on cache, namespace or bucket"},
+ {"project-create", &CreateProjectCmd, "Create a project"},
{"project-drop", &ProjectDropCmd, "Drop project or project oplog"},
{"project-info", &ProjectInfoCmd, "Info on project or project oplog"},
- {"project-create", &CreateProjectCmd, "Create a project"},
- {"oplog-create", &CreateOplogCmd, "Create a project oplog"},
- {"oplog-export", &ExportOplogCmd, "Export project store oplog"},
- {"oplog-import", &ImportOplogCmd, "Import project store oplog"},
- {"gc", &GcCmd, "Garbage collect zen storage"},
- {"gc-status", &GcStatusCmd, "Garbage collect zen storage status check"},
+ {"ps", &PsCmd, "Enumerate running zen server instances"},
+ {"rpc-record-replay", &RpcReplayCmd, "Stops recording of cache rpc requests on a host"},
{"rpc-record-start", &RpcStartRecordingCmd, "Replays a previously recorded session of rpc requests"},
{"rpc-record-stop", &RpcStopRecordingCmd, "Starts recording of cache rpc requests on a host"},
- {"rpc-record-replay", &RpcReplayCmd, "Stops recording of cache rpc requests on a host"},
+ {"status", &StatusCmd, "Show zen status"},
+ {"top", &TopCmd, "Monitor zen server activity"},
+ {"up", &UpCmd, "Bring zen server up"},
+ {"version", &VersionCmd, "Get zen server version"},
#if ZEN_WITH_TESTS
{"runtests", &RunTestsCmd, "Run zen tests"},
#endif
@@ -334,6 +338,7 @@ main(int argc, char** argv)
std::string SubCommand = "<None>";
cxxopts::Options Options("zen", "Zen management tool");
+
Options.add_options()("d, debug", "Enable debugging", cxxopts::value<bool>(GlobalOptions.IsDebug));
Options.add_options()("v, verbose", "Enable verbose logging", cxxopts::value<bool>(GlobalOptions.IsVerbose));
Options.add_options()("help", "Show command line help");
@@ -394,7 +399,7 @@ main(int argc, char** argv)
{
std::string HelpMessage = Options.help();
- printf("Error parsing snapshot program arguments: %s\n\n%s", Ex.what(), HelpMessage.c_str());
+ printf("Error parsing program arguments: %s\n\n%s", Ex.what(), HelpMessage.c_str());
return 9;
}
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index 6a9e19e50..e3b364ea1 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -964,13 +964,16 @@ ZenEntryPoint::Run()
InitializeLogging(ServerOptions);
#if ZEN_USE_SENTRY
- if (SentryErrorCode == 0)
+ if (m_ServerOptions.NoSentry == false)
{
- ZEN_INFO("sentry initialized");
- }
- else
- {
- ZEN_WARN("sentry_init returned failure! (error code: {})", SentryErrorCode);
+ if (SentryErrorCode == 0)
+ {
+ ZEN_INFO("sentry initialized");
+ }
+ else
+ {
+ ZEN_WARN("sentry_init returned failure! (error code: {})", SentryErrorCode);
+ }
}
#endif