Skip to content

Commit

Permalink
Canonical variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
lqxhub committed Apr 1, 2024
1 parent 4dfbde7 commit 84051de
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/base_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ BaseCmd::BaseCmd(std::string name, int16_t arity, uint32_t flag, uint32_t aclCat
name_ = std::move(name);
arity_ = arity;
flag_ = flag;
aclCategory_ = aclCategory;
cmdID_ = g_pikiwidb->GetCmdID();
acl_category_ = aclCategory;
cmd_id_ = g_pikiwidb->GetCmdID();
}

bool BaseCmd::CheckArg(size_t num) const {
Expand Down Expand Up @@ -46,13 +46,13 @@ void BaseCmd::SetFlag(uint32_t flag) { flag_ |= flag; }
void BaseCmd::ResetFlag(uint32_t flag) { flag_ &= ~flag; }
bool BaseCmd::HasSubCommand() const { return false; }
BaseCmd* BaseCmd::GetSubCmd(const std::string& cmdName) { return nullptr; }
uint32_t BaseCmd::AclCategory() const { return aclCategory_; }
void BaseCmd::AddAclCategory(uint32_t aclCategory) { aclCategory_ |= aclCategory; }
uint32_t BaseCmd::AclCategory() const { return acl_category_; }
void BaseCmd::AddAclCategory(uint32_t aclCategory) { acl_category_ |= aclCategory; }
std::string BaseCmd::Name() const { return name_; }
// CmdRes& BaseCommand::Res() { return res_; }
// void BaseCommand::SetResp(const std::shared_ptr<std::string>& resp) { resp_ = resp; }
// std::shared_ptr<std::string> BaseCommand::GetResp() { return resp_.lock(); }
uint32_t BaseCmd::GetCmdID() const { return cmdID_; }
uint32_t BaseCmd::GetCmdID() const { return cmd_id_; }

// BaseCmdGroup
BaseCmdGroup::BaseCmdGroup(const std::string& name, uint32_t flag) : BaseCmdGroup(name, -2, flag) {}
Expand Down
4 changes: 2 additions & 2 deletions src/base_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ class BaseCmd : public std::enable_shared_from_this<BaseCmd> {
// std::weak_ptr<std::string> resp_;
// uint64_t doDuration_ = 0;

uint32_t cmdID_ = 0;
uint32_t aclCategory_ = 0;
uint32_t cmd_id_ = 0;
uint32_t acl_category_ = 0;

private:
// The function to be executed first before executing `DoCmd`
Expand Down
1 change: 1 addition & 0 deletions src/io_thread_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class WorkIOThreadPool : public IOThreadPool {
private:
void StartWorkers() override;

private:
std::vector<std::thread> writeThreads_;
std::vector<std::unique_ptr<std::mutex>> writeMutex_;
std::vector<std::unique_ptr<std::condition_variable>> writeCond_;
Expand Down
4 changes: 2 additions & 2 deletions src/pikiwidb.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PikiwiDB final {
void OnNewConnection(pikiwidb::TcpConnection* obj);

// pikiwidb::CmdTableManager& GetCmdTableManager();
uint32_t GetCmdID() { return ++cmdId_; };
uint32_t GetCmdID() { return ++cmd_id_; };

void SubmitFast(const std::shared_ptr<pikiwidb::CmdThreadPoolTask>& runner) { cmd_threads_.SubmitFast(runner); }

Expand All @@ -52,7 +52,7 @@ class PikiwiDB final {
pikiwidb::CmdThreadPool cmd_threads_;
// pikiwidb::CmdTableManager cmd_table_manager_;

uint32_t cmdId_ = 0;
uint32_t cmd_id_ = 0;
};

extern std::unique_ptr<PikiwiDB> g_pikiwidb;

0 comments on commit 84051de

Please sign in to comment.