aboutsummaryrefslogtreecommitdiff
path: root/src/zen/zen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zen/zen.cpp')
-rw-r--r--src/zen/zen.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/zen/zen.cpp b/src/zen/zen.cpp
index 7f0549d42..3ae62e29d 100644
--- a/src/zen/zen.cpp
+++ b/src/zen/zen.cpp
@@ -23,8 +23,8 @@
#include <zencore/logging.h>
#include <zencore/scopeguard.h>
#include <zencore/string.h>
-
#include <zenhttp/httpcommon.h>
+#include <zenutil/zenserverprocess.h>
#if ZEN_WITH_TESTS
# define ZEN_TEST_WITH_RUNNER 1
@@ -208,6 +208,7 @@ main(int argc, char** argv)
RpcReplayCommand RpcReplayCmd;
RpcStartRecordingCommand RpcStartRecordingCmd;
RpcStopRecordingCommand RpcStopRecordingCmd;
+ ScrubCommand ScrubCmd;
StatusCommand StatusCmd;
TopCommand TopCmd;
UpCommand UpCmd;
@@ -248,6 +249,7 @@ main(int argc, char** argv)
{"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"},
+ {"scrub", &ScrubCmd, "Scrub zen storage (verify data integrity)"},
{"status", &StatusCmd, "Show zen status"},
{"top", &TopCmd, "Monitor zen server activity"},
{"up", &UpCmd, "Bring zen server up"},
@@ -435,3 +437,28 @@ main(int argc, char** argv)
return 0;
}
+
+std::string
+ZenCmdBase::ResolveTargetHostSpec(const std::string& InHostSpec)
+{
+ if (InHostSpec.empty())
+ {
+ zen::ZenServerState Servers;
+
+ if (Servers.InitializeReadOnly())
+ {
+ std::string ResolvedSpec = InHostSpec;
+
+ Servers.Snapshot([&](const zen::ZenServerState::ZenServerEntry& Entry) {
+ if (ResolvedSpec.empty())
+ {
+ ResolvedSpec = fmt::format("http://localhost:{}", Entry.EffectiveListenPort);
+ }
+ });
+
+ return ResolvedSpec;
+ }
+ }
+
+ return InHostSpec;
+}