Skip to content

Commit 468f4d8

Browse files
committed
fix: clang-format code
1 parent 9efe889 commit 468f4d8

File tree

7 files changed

+463
-484
lines changed

7 files changed

+463
-484
lines changed

src/commands/cmd_topk.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
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";
3030
constexpr const char *errBadDepth = "Bad depth";
3131
constexpr const char *errBadDecay = "Bad decay";
3232
constexpr const char *errInvalidDecay = "Decay must be between 0 and 1";
33-
}
33+
} // namespace
3434

3535
namespace 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

src/storage/redis_metadata.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ enum RedisType : uint8_t {
5959
};
6060

6161
inline constexpr const std::array<std::string_view, kRedisTypeMax> RedisTypeNames = {
62-
"none", "string", "hash", "list", "set", "zset", "bitmap",
63-
"sortedint", "stream", "MBbloom--", "ReJSON-RL", "hyperloglog", "TDIS-TYPE", "timeseries",
64-
"topk"};
62+
"none", "string", "hash", "list", "set", "zset", "bitmap", "sortedint",
63+
"stream", "MBbloom--", "ReJSON-RL", "hyperloglog", "TDIS-TYPE", "timeseries", "topk"};
6564

6665
struct RedisTypes {
6766
RedisTypes(std::initializer_list<RedisType> list) {
@@ -413,20 +412,16 @@ class TimeSeriesMetadata : public Metadata {
413412
};
414413

415414
class TopKMetadata : public Metadata {
416-
public:
415+
public:
417416
uint32_t top_k;
418417
uint16_t width;
419418
uint32_t depth;
420419
double decay;
421420

422421
explicit TopKMetadata(bool generate_version = true) : Metadata(kRedisTopK, generate_version) {}
423422

424-
TopKMetadata(uint64_t top_k, uint64_t width = 7, uint64_t depth = 8, double decay = 0.9, bool generate_version = true)
425-
: Metadata(kRedisTopK, generate_version),
426-
top_k(top_k),
427-
width(width),
428-
depth(depth),
429-
decay(decay) {}
423+
TopKMetadata(uint64_t top_k, uint64_t width = 7, uint64_t depth = 8, double decay = 0.9, bool generate_version = true)
424+
: Metadata(kRedisTopK, generate_version), top_k(top_k), width(width), depth(depth), decay(decay) {}
430425

431426
void Encode(std::string *dst) const override;
432427
rocksdb::Status Decode(Slice *input) override;

0 commit comments

Comments
 (0)