1818 *
1919 */
2020
21- #include " commander.h"
2221#include " command_parser.h"
22+ #include " commander.h"
2323#include " error_constants.h"
2424#include " server/server.h"
2525#include " types/redis_topk.h"
@@ -30,7 +30,7 @@ constexpr const char *errBadWidth = "Bad width";
3030constexpr const char *errBadDepth = " Bad depth" ;
3131constexpr const char *errBadDecay = " Bad decay" ;
3232constexpr const char *errInvalidDecay = " Decay must be between 0 and 1" ;
33- }
33+ } // namespace
3434
3535namespace redis {
3636
@@ -84,6 +84,7 @@ class CommandTopKReserve final : public Commander {
8484 *output = redis::RESP_OK ;
8585 return Status::OK ();
8686 }
87+
8788 private:
8889 uint32_t k_;
8990 uint32_t width_ = 7 ;
@@ -150,7 +151,7 @@ class CommandTopKInfo final : public Commander {
150151 return Commander::Parse (args);
151152 }
152153
153- Status Execute (engine::Context &ctx, Server *srv, Connection *conn, [[maybe_unused]] std::string *output) override {
154+ Status Execute (engine::Context &ctx, Server *srv, Connection *conn, std::string *output) override {
154155 redis::TopK topk_db (srv->storage , conn->GetNamespace ());
155156 TopKInfo info;
156157
@@ -185,6 +186,7 @@ class CommandTopKInfo final : public Commander {
185186 }
186187 return Status::OK ();
187188 }
189+
188190 private:
189191 TopKInfoType type_ = TopKInfoType::kAll ;
190192};
@@ -199,7 +201,7 @@ class CommandTopKQuery final : public Commander {
199201 auto s = topk.Query (ctx, args_[1 ], args_[2 ], &is_exists_);
200202 if (!s.ok ()) {
201203 return {Status::RedisExecErr, s.ToString ()};
202- }
204+ }
203205 *output = redis::Bool (redis::RESP ::v2, is_exists_);
204206 return Status::OK ();
205207 }
@@ -211,4 +213,4 @@ REDIS_REGISTER_COMMANDS(TopK, MakeCmdAttr<CommandTopKAdd>("topk.add", 3, "write"
211213 MakeCmdAttr<CommandTopKQuery>(" topk.query" , 3 , " read-only" , 1 , 1 , 1 ),
212214 MakeCmdAttr<CommandTopKReserve>(" topk.reserve" , -3 , " write" , 1 , 1 , 1 ));
213215
214- } // namespace redis
216+ } // namespace redis
0 commit comments