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 ;
@@ -131,6 +132,7 @@ class CommandTopKIncrBy final : public Commander {
131132 *output = redis::RESP_OK;
132133 return Status::OK ();
133134 }
135+
134136 private:
135137 uint32_t incr_;
136138};
@@ -179,7 +181,7 @@ class CommandTopKInfo final : public Commander {
179181 return Commander::Parse (args);
180182 }
181183
182- Status Execute (engine::Context &ctx, Server *srv, Connection *conn, [[maybe_unused]]std::string *output) override {
184+ Status Execute (engine::Context &ctx, Server *srv, Connection *conn, [[maybe_unused]] std::string *output) override {
183185 redis::TopK topk_db (srv->storage , conn->GetNamespace ());
184186 TopKInfo info;
185187
@@ -214,6 +216,7 @@ class CommandTopKInfo final : public Commander {
214216 }
215217 return Status::OK ();
216218 }
219+
217220 private:
218221 TopKInfoType type_ = TopKInfoType::kAll ;
219222};
@@ -228,7 +231,7 @@ class CommandTopKQuery final : public Commander {
228231 auto s = topk.Query (ctx, args_[1 ], args_[2 ], &is_exists_);
229232 if (!s.ok ()) {
230233 return {Status::RedisExecErr, s.ToString ()};
231- }
234+ }
232235 *output = redis::Bool (redis::RESP::v2, is_exists_);
233236 return Status::OK ();
234237 }
@@ -241,4 +244,4 @@ REDIS_REGISTER_COMMANDS(TopK, MakeCmdAttr<CommandTopKAdd>("topk.add", 3, "write"
241244 MakeCmdAttr<CommandTopKReserve>(" topk.reserve" , -3 , " write" , 1 , 1 , 1 ),
242245 MakeCmdAttr<CommandTopKIncrBy>(" topk.incrby" , 4 , " write" , 1 , 1 , 1 ));
243246
244- } // namespace redis
247+ } // namespace redis
0 commit comments