From d222884492f7c9af8148adb6c26dd66e490ca957 Mon Sep 17 00:00:00 2001
From: Georgios Bitzes <georgios.bitzes@cern.ch>
Date: Fri, 9 Aug 2019 17:41:58 +0200
Subject: [PATCH] Add 'activate-push-types' command to indicate a client
supports RESP3 push types - no effect for now
---
src/Commands.cc | 1 +
src/Commands.hh | 1 +
src/Connection.cc | 8 ++++++++
src/Connection.hh | 4 ++++
src/QuarkDBNode.cc | 4 ++++
5 files changed, 18 insertions(+)
diff --git a/src/Commands.cc b/src/Commands.cc
index 1b45886c..768291c3 100644
--- a/src/Commands.cc
+++ b/src/Commands.cc
@@ -36,6 +36,7 @@ struct cmdMapInit {
redis_cmd_map["monitor"] = {RedisCommand::MONITOR, CommandType::CONTROL};
redis_cmd_map["client_id"] = {RedisCommand::CLIENT_ID, CommandType::CONTROL};
redis_cmd_map["command_stats"] = {RedisCommand::COMMAND_STATS, CommandType::CONTROL};
+ redis_cmd_map["activate_push_types"] = {RedisCommand::ACTIVATE_PUSH_TYPES, CommandType::CONTROL};
redis_cmd_map["auth"] = {RedisCommand::AUTH, CommandType::AUTHENTICATION};
redis_cmd_map["hmac_auth_generate_challenge"] = {RedisCommand::HMAC_AUTH_GENERATE_CHALLENGE, CommandType::AUTHENTICATION};
diff --git a/src/Commands.hh b/src/Commands.hh
index 8aeaab3f..00b3758d 100644
--- a/src/Commands.hh
+++ b/src/Commands.hh
@@ -36,6 +36,7 @@ enum class RedisCommand {
MONITOR,
CLIENT_ID,
COMMAND_STATS,
+ ACTIVATE_PUSH_TYPES,
FLUSHALL,
diff --git a/src/Connection.cc b/src/Connection.cc
index e3b58849..3d79ccf2 100644
--- a/src/Connection.cc
+++ b/src/Connection.cc
@@ -175,6 +175,10 @@ LogIndex PendingQueue::dispatchPending(RedisDispatcher *dispatcher, LogIndex com
return -1;
}
+void PendingQueue::activatePushTypes() {
+ supportsPushTypes = true;
+}
+
size_t phantomBatchLimit = 100;
void Connection::setPhantomBatchLimit(size_t newval) {
@@ -342,3 +346,7 @@ void Connection::flush() {
std::string Connection::describe() const {
return description;
}
+
+void Connection::activatePushTypes() {
+ pendingQueue->activatePushTypes();
+}
diff --git a/src/Connection.hh b/src/Connection.hh
index a0c34849..9f9b5902 100644
--- a/src/Connection.hh
+++ b/src/Connection.hh
@@ -77,6 +77,8 @@ public:
bool addMessageIfAttached(const std::string &channel, RedisEncodedResponse &&raw);
bool addPatternMessageIfAttached(const std::string &pattern, RedisEncodedResponse &&raw);
+ void activatePushTypes();
+
private:
LinkStatus appendResponseNoLock(RedisEncodedResponse &&raw);
Connection *conn;
@@ -110,6 +112,7 @@ private:
LogIndex lastIndex = -1;
std::queue<PendingRequest> pending;
SubscriptionTracker subscriptionTracker;
+ bool supportsPushTypes = false;
};
//------------------------------------------------------------------------------
@@ -186,6 +189,7 @@ public:
Connection *conn;
};
+ void activatePushTypes();
static void setPhantomBatchLimit(size_t newval);
private:
BufferedWriter writer;
diff --git a/src/QuarkDBNode.cc b/src/QuarkDBNode.cc
index 13c7fe12..bb66bc89 100644
--- a/src/QuarkDBNode.cc
+++ b/src/QuarkDBNode.cc
@@ -128,6 +128,10 @@ LinkStatus QuarkDBNode::dispatch(Connection *conn, RedisRequest &req) {
case RedisCommand::CLIENT_ID: {
return conn->status(conn->getID());
}
+ case RedisCommand::ACTIVATE_PUSH_TYPES: {
+ conn->activatePushTypes();
+ return conn->ok();
+ }
case RedisCommand::QUARKDB_INFO: {
return conn->statusVector(this->info().toVector());
}
--
GitLab