Skip to content

Commit 1dba127

Browse files
committed
rebase onto unstable, format code
1 parent 7377133 commit 1dba127

5 files changed

Lines changed: 44 additions & 45 deletions

File tree

include/pika_client_conn.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class PikaClientConn : public net::RedisConn {
6969
bool IsPubSub() { return is_pubsub_; }
7070
void SetIsPubSub(bool is_pubsub) { is_pubsub_ = is_pubsub; }
7171
void SetCurrentTable(const std::string& db_name) { current_db_ = db_name; }
72-
const std::string& GetCurrentTable() override{ return current_db_; }
72+
const std::string& GetCurrentTable() override { return current_db_; }
7373
void SetWriteCompleteCallback(WriteCompleteCallback cb) { write_completed_cb_ = std::move(cb); }
7474

7575
void DoAuth(const std::shared_ptr<User>& user);

include/pika_command.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ enum CmdFlagsMask {
239239
};
240240

241241
enum CmdFlags {
242-
kCmdFlagsRead = 1, // default rw
242+
kCmdFlagsRead = 1, // default rw
243243
kCmdFlagsWrite = (1 << 1),
244244
kCmdFlagsAdmin = (1 << 2), // default type
245245
kCmdFlagsKv = (1 << 3),
@@ -251,13 +251,13 @@ enum CmdFlags {
251251
kCmdFlagsHyperLogLog = (1 << 9),
252252
kCmdFlagsGeo = (1 << 10),
253253
kCmdFlagsPubSub = (1 << 11),
254-
kCmdFlagsNoLocal = 0, // default nolocal
254+
kCmdFlagsNoLocal = 0, // default nolocal
255255
kCmdFlagsLocal = (1 << 12),
256-
kCmdFlagsNoSuspend = 0, // default nosuspend
256+
kCmdFlagsNoSuspend = 0, // default nosuspend
257257
kCmdFlagsSuspend = (1 << 13),
258-
kCmdFlagsNoPrior = 0, // default noprior
258+
kCmdFlagsNoPrior = 0, // default noprior
259259
kCmdFlagsPrior = 128,
260-
kCmdFlagsNoAdminRequire = 0, // default no need admin
260+
kCmdFlagsNoAdminRequire = 0, // default no need admin
261261
kCmdFlagsAdminRequire = (1 << 14),
262262
kCmdFlagsDoNotSpecifySlot = 0, // default do not specify slot
263263
kCmdFlagsSingleSlot = (1 << 15),
@@ -269,7 +269,7 @@ enum CmdFlags {
269269
void inline RedisAppendContent(std::string& str, const std::string& value);
270270
void inline RedisAppendLen(std::string& str, int64_t ori, const std::string& prefix);
271271
void inline RedisAppendLenUint64(std::string& str, uint64_t ori, const std::string& prefix) {
272-
RedisAppendLen(str, static_cast<int64_t>(ori), prefix);
272+
RedisAppendLen(str, static_cast<int64_t>(ori), prefix);
273273
}
274274

275275
const std::string kNewLine = "\r\n";
@@ -431,9 +431,9 @@ class CmdRes {
431431
struct UnblockTaskArgs {
432432
std::string key;
433433
std::shared_ptr<Slot> slot;
434-
net::DispatchThread* dispatchThread{ nullptr };
434+
net::DispatchThread* dispatchThread{nullptr};
435435
UnblockTaskArgs(std::string key_, std::shared_ptr<Slot> slot_, net::DispatchThread* dispatchThread_)
436-
: key(std::move(key_)), slot(slot_), dispatchThread(dispatchThread_) {}
436+
: key(std::move(key_)), slot(std::move(slot_)), dispatchThread(dispatchThread_) {}
437437
};
438438

439439
class Cmd : public std::enable_shared_from_this<Cmd> {
@@ -468,8 +468,6 @@ class Cmd : public std::enable_shared_from_this<Cmd> {
468468
};
469469
CommandStatistics state;
470470
Cmd(std::string name, int arity, uint16_t flag, uint32_t aclCategory = 0);
471-
// Cmd(std::string name, int arity, uint16_t flag);
472-
Cmd(std::string name, int arity, uint16_t flag) : name_(std::move(name)), arity_(arity), flag_(flag) {}
473471
virtual ~Cmd() = default;
474472

475473
virtual std::vector<std::string> current_key() const;

include/pika_conf.h

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,18 @@ class PikaConf : public pstd::BaseConf {
175175
std::shared_lock l(rwlock_);
176176
return bgsave_prefix_;
177177
}
178-
// std::string userpass() {
179-
// std::shared_lock l(rwlock_);
180-
// return userpass_;
181-
// }
182-
// std::string suser_blacklist() {
183-
// std::shared_lock l(rwlock_);
184-
// return pstd::StringConcat(user_blacklist_, COMMA);
185-
// }
186-
// const std::vector<std::string>& vuser_blacklist() {
187-
// std::shared_lock l(rwlock_);
188-
// return user_blacklist_;
189-
// }
178+
// std::string userpass() {
179+
// std::shared_lock l(rwlock_);
180+
// return userpass_;
181+
// }
182+
// std::string suser_blacklist() {
183+
// std::shared_lock l(rwlock_);
184+
// return pstd::StringConcat(user_blacklist_, COMMA);
185+
// }
186+
// const std::vector<std::string>& vuser_blacklist() {
187+
// std::shared_lock l(rwlock_);
188+
// return user_blacklist_;
189+
// }
190190
bool classic_mode() { return classic_mode_.load(); }
191191
int databases() {
192192
std::shared_lock l(rwlock_);
@@ -446,19 +446,19 @@ class PikaConf : public pstd::BaseConf {
446446
TryPushDiffCommands("masterauth", value);
447447
masterauth_ = value;
448448
}
449-
// void SetUserPass(const std::string& value) {
450-
// std::lock_guard l(rwlock_);
451-
// TryPushDiffCommands("userpass", value);
452-
// userpass_ = value;
453-
// }
454-
// void SetUserBlackList(const std::string& value) {
455-
// std::lock_guard l(rwlock_);
456-
// TryPushDiffCommands("userblacklist", value);
457-
// pstd::StringSplit(value, COMMA, user_blacklist_);
458-
// for (auto& item : user_blacklist_) {
459-
// pstd::StringToLower(item);
460-
// }
461-
// }
449+
// void SetUserPass(const std::string& value) {
450+
// std::lock_guard l(rwlock_);
451+
// TryPushDiffCommands("userpass", value);
452+
// userpass_ = value;
453+
// }
454+
// void SetUserBlackList(const std::string& value) {
455+
// std::lock_guard l(rwlock_);
456+
// TryPushDiffCommands("userblacklist", value);
457+
// pstd::StringSplit(value, COMMA, user_blacklist_);
458+
// for (auto& item : user_blacklist_) {
459+
// pstd::StringToLower(item);
460+
// }
461+
// }
462462
void SetSlotMigrate(const std::string& value) {
463463
std::lock_guard l(rwlock_);
464464
slotmigrate_ = (value == "yes") ? true : false;
@@ -581,9 +581,8 @@ class PikaConf : public pstd::BaseConf {
581581
max_rsync_parallel_num_ = value;
582582
}
583583

584-
pstd::Status DBSlotsSanityCheck(const std::string& db_name, const std::set<uint32_t>& slot_ids,
585-
bool is_add);
586-
// pstd::Status DBSlotsSanityCheck(const std::string& db_name, const std::set<uint32_t>& slot_ids, bool is_add);
584+
pstd::Status DBSlotsSanityCheck(const std::string& db_name, const std::set<uint32_t>& slot_ids, bool is_add);
585+
// pstd::Status DBSlotsSanityCheck(const std::string& db_name, const std::set<uint32_t>& slot_ids, bool is_add);
587586
pstd::Status AddDBSlots(const std::string& db_name, const std::set<uint32_t>& slot_ids);
588587
pstd::Status RemoveDBSlots(const std::string& db_name, const std::set<uint32_t>& slot_ids);
589588
pstd::Status AddDB(const std::string& db_name, uint32_t slot_num);
@@ -612,8 +611,8 @@ class PikaConf : public pstd::BaseConf {
612611
int db_sync_speed_ = 0;
613612
std::string compact_cron_;
614613
std::string compact_interval_;
615-
int64_t resume_check_interval_ = 60; // seconds
616-
int64_t least_free_disk_to_resume_ = 268435456; // 256 MB
614+
int64_t resume_check_interval_ = 60; // seconds
615+
int64_t least_free_disk_to_resume_ = 268435456; // 256 MB
617616
double min_check_resume_ratio_ = 0.7;
618617
int64_t write_buffer_size_ = 0;
619618
int64_t arena_block_size_ = 0;
@@ -630,8 +629,8 @@ class PikaConf : public pstd::BaseConf {
630629
std::string replication_id_;
631630
std::string requirepass_;
632631
std::string masterauth_;
633-
// std::string userpass_;
634-
// std::vector<std::string> user_blacklist_;
632+
// std::string userpass_;
633+
// std::vector<std::string> user_blacklist_;
635634
std::atomic<bool> classic_mode_;
636635
int databases_ = 0;
637636
int default_slot_num_ = 0;

include/pika_list.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ class LLenCmd : public Cmd {
7878

7979
class BlockingBaseCmd : public Cmd {
8080
public:
81-
BlockingBaseCmd(const std::string& name, int arity, uint16_t flag) : Cmd(name, arity, flag) {}
81+
BlockingBaseCmd(const std::string& name, int arity, uint16_t flag)
82+
: Cmd(name, arity, flag, static_cast<uint32_t>(AclCategory::LIST)) {}
8283

8384
//blpop/brpop used start
8485
struct WriteBinlogOfPopArgs{

src/pika_acl.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
// LICENSE file in the root directory of this source tree. An additional grant
44
// of patent rights can be found in the PATENTS file in the same directory.
55

6+
#include <fmt/format.h>
7+
68
#include "include/pika_acl.h"
7-
#include "fmt/format.h"
89
#include "include/pika_client_conn.h"
910
#include "include/pika_cmd_table_manager.h"
1011

0 commit comments

Comments
 (0)