mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
feat(server): hello and info sidekiq compatibility (#941)
Signed-off-by: ashotland <ari@dragonflydb.io>
This commit is contained in:
parent
66b4fbd14e
commit
eb962bb5a1
2 changed files with 20 additions and 8 deletions
|
@ -222,13 +222,14 @@ TEST_F(DflyEngineTest, EvalSha) {
|
|||
|
||||
TEST_F(DflyEngineTest, Hello) {
|
||||
auto resp = Run({"hello"});
|
||||
ASSERT_THAT(resp, ArrLen(12));
|
||||
ASSERT_THAT(resp, ArrLen(14));
|
||||
resp = Run({"hello", "2"});
|
||||
ASSERT_THAT(resp, ArrLen(12));
|
||||
ASSERT_THAT(resp, ArrLen(14));
|
||||
|
||||
EXPECT_THAT(resp.GetVec(), ElementsAre("server", "redis", "version", ArgType(RespExpr::STRING),
|
||||
"proto", IntArg(2), "id", ArgType(RespExpr::INT64), "mode",
|
||||
"standalone", "role", "master"));
|
||||
EXPECT_THAT(resp.GetVec(),
|
||||
ElementsAre("server", "redis", "version", "6.2.11", "dfly_version",
|
||||
ArgType(RespExpr::STRING), "proto", IntArg(2), "id",
|
||||
ArgType(RespExpr::INT64), "mode", "standalone", "role", "master"));
|
||||
|
||||
// These are valid arguments to HELLO, however as they are not yet supported the implementation
|
||||
// is degraded to 'unknown command'.
|
||||
|
|
|
@ -83,6 +83,8 @@ using util::http::StringResponse;
|
|||
|
||||
namespace {
|
||||
|
||||
const auto kRedisVersion = "6.2.11";
|
||||
|
||||
const auto kRdbWriteFlags = O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC | O_DIRECT;
|
||||
|
||||
using EngineFunc = void (ServerFamily::*)(CmdArgList args, ConnectionContext* cntx);
|
||||
|
@ -1456,7 +1458,8 @@ void ServerFamily::Info(CmdArgList args, ConnectionContext* cntx) {
|
|||
|
||||
ADD_HEADER("# Server");
|
||||
|
||||
append("redis_version", GetVersion());
|
||||
append("redis_version", kRedisVersion);
|
||||
append("dfly_version", GetVersion());
|
||||
append("redis_mode", "standalone");
|
||||
append("arch_bits", 64);
|
||||
append("multiplexing_api", multiplex_api);
|
||||
|
@ -1515,7 +1518,13 @@ void ServerFamily::Info(CmdArgList args, ConnectionContext* cntx) {
|
|||
append("pipeline_cache_bytes", m.conn_stats.pipeline_cache_capacity);
|
||||
append("maxmemory", max_memory_limit);
|
||||
append("maxmemory_human", HumanReadableNumBytes(max_memory_limit));
|
||||
append("cache_mode", GetFlag(FLAGS_cache_mode) ? "cache" : "store");
|
||||
if (GetFlag(FLAGS_cache_mode)) {
|
||||
append("cache_mode", "cache");
|
||||
} else {
|
||||
append("cache_mode", "store");
|
||||
// Compatible with redis based frameworks.
|
||||
append("maxmemory_policy", "noeviction");
|
||||
}
|
||||
}
|
||||
|
||||
if (should_enter("STATS")) {
|
||||
|
@ -1693,10 +1702,12 @@ void ServerFamily::Hello(CmdArgList args, ConnectionContext* cntx) {
|
|||
}
|
||||
}
|
||||
|
||||
(*cntx)->StartArray(12);
|
||||
(*cntx)->StartArray(14);
|
||||
(*cntx)->SendBulkString("server");
|
||||
(*cntx)->SendBulkString("redis");
|
||||
(*cntx)->SendBulkString("version");
|
||||
(*cntx)->SendBulkString(kRedisVersion);
|
||||
(*cntx)->SendBulkString("dfly_version");
|
||||
(*cntx)->SendBulkString(GetVersion());
|
||||
(*cntx)->SendBulkString("proto");
|
||||
(*cntx)->SendLong(2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue