Skip to content

Commit

Permalink
Merge branch 'unstable' into feature/tdigest-for-first-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice authored Feb 9, 2025
2 parents baaf561 + 5055f57 commit 75c0361
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 210 deletions.
4 changes: 2 additions & 2 deletions src/commands/cmd_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class CommandInfo : public Commander {
Status Execute([[maybe_unused]] engine::Context &ctx, Server *srv, Connection *conn, std::string *output) override {
std::vector<std::string> sections;
for (size_t i = 1; i < args_.size(); ++i) {
sections.push_back(util::ToLower(args_[i]));
sections.push_back(args_[i]);
}
auto info = srv->GetInfo(conn->GetNamespace(), sections);
*output = conn->VerbatimString("txt", info);
Expand Down Expand Up @@ -282,7 +282,7 @@ class CommandRole : public Commander {
public:
Status Execute([[maybe_unused]] engine::Context &ctx, Server *srv, [[maybe_unused]] Connection *conn,
std::string *output) override {
srv->GetRoleInfo(output);
*output = srv->GetRoleInfo();
return Status::OK();
}
};
Expand Down
5 changes: 5 additions & 0 deletions src/common/string_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ std::vector<std::string> Split(std::string_view in, std::string_view delim);
std::vector<std::string> Split2KV(const std::string &in, const std::string &delim);
bool HasPrefix(const std::string &str, const std::string &prefix);

template <typename Iter>
Iter FindICase(Iter begin, Iter end, std::string_view expected) {
return std::find_if(begin, end, [expected](const auto &v) { return EqualICase(v, expected); });
}

Status ValidateGlob(std::string_view glob);
bool StringMatch(std::string_view glob, std::string_view str, bool ignore_case = false);
std::pair<std::string, std::string> SplitGlob(std::string_view glob);
Expand Down
Loading

0 comments on commit 75c0361

Please sign in to comment.