-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
command develop tasks #30
Comments
string: get done |
hashtable ncy: csx: pcy: qxh: ncy: |
set: whr: cwl: crp: whr: cwl: Henry: pcy: |
我写了个小工具用于对比 pikiwidb 与 redis 输出,在实现命令时可以用来与 redis 对比。 |
This comment was marked as resolved.
This comment was marked as resolved.
list: cwl: liuhuan: csq: cwl: henry: lh: |
zset done whr: pl: wxr: csx: |
key: henry: lft: cwl: lh: |
// admin select done dingxiaoshuai panlei: pcy lft: renzhenfeng(0629): lh: tangruilin: bzm: smj zzl: zhy: 2024.6.15 gkj: 2024.6.15 optics: ping done todo: |
issue: #30 Signed-off-by: HappyUncle <[email protected]>
我想认领一下string 的 msetnx命令的实现,我目前的想法是:参照PikiviDB MSetCmd类的实现和pika MsetCmd MsetnxCmd类的实现,在PikiwiDB实现一个新的MSetNXCmd类,这个类主要的函数有DoInitial,DoCmd |
测试: |
Go Test测试移植Pika的到PikiwiDB @dingxiaoshuai123 |
Go Test tests porting Pika to PikiwiDB @dingxiaoshuai123 |
@Tangruilin 看todo |
@Tangruilin nantodo |
trl: 我先把这个实现以下吧 |
trl: Let me implement this first: |
issue: OpenAtomFoundation#30 issue: OpenAtomFoundation#280 Signed-off-by: HappyUncle <[email protected]>
issue: OpenAtomFoundation#30 issue: OpenAtomFoundation#280 Signed-off-by: HappyUncle <[email protected]>
issue: OpenAtomFoundation#30 issue: OpenAtomFoundation#280 Signed-off-by: HappyUncle <[email protected]>
issue: OpenAtomFoundation#30 issue: OpenAtomFoundation#280 Signed-off-by: HappyUncle <[email protected]>
issue: OpenAtomFoundation#30 issue: OpenAtomFoundation#280 Signed-off-by: HappyUncle <[email protected]>
issue: #30 issue: #280 Signed-off-by: HappyUncle <[email protected]>
RedisRaft 支持的 Redis 命令列表 https://github.com/RedisLabs/redisraft/blob/master/docs/Using.md |
pikiwidb 命令处理相关功能的开发
在pikiwidb中, 每一个命令处理对应一个C++的class, 当服务端收到一条命令时,会去找这个命令处理对应的对象, 如果没有找到返回错误, 如果找到后, 执行对应的命令.
函数入口(这是临时处理函数,后面会调整这个函数的实现)
pikiwidb/src/client.cc
Line 244 in e05878d
命令处理相关代码
BaseCmd
是所有命令处理类的基类,pikiwidb/src/base_cmd.h
Line 89 in e05878d
所有命令处理的class需要继承这个类, 并且重写
DoInitial
和DoCmd
这两个虚函数.DoInitial
函数, 在命令执行前调用, 负责处理命令执行需要的参数, 例如把 命令的key找到, 命令参数的大小写转换等等DoCmd
函数, 命令执行时的逻辑处理函数, 负责整个命令的具体处理逻辑需要在 构造函数中,给
BaseCmd
的flag
赋值, flag值根据实际情况确定, 例子:pikiwidb/src/cmd_kv.cc
Line 13 in e05878d
命令分类
命令分为两大类
GET
,SET
,HSET
,HMGET
等等CONFIG
,CLINET
等等, 这些命令通过第二个参数来区分, 具体执行的是哪个命令, 每个不同的子命令, 有不同的处理逻辑, 例如CONFIG GET XXX
和CONFIG SET XXX
是两个不同的命令.有子命令的需要特殊处理, 具体可以参考
CONFIG
命令的实现pikiwidb/src/cmd_admin.h
Line 15 in e05878d
命令注册
所有的命令需要把命令对象的指针注册(写入)到 commandManager 这个map中, map的 key 是 命令名, value 是处理这个命令的指针
命令注册函数
pikiwidb/src/cmd_table_manager.cc
Line 20 in e05878d
代码文件
代码文件, 每个类型的命令有一个单独的文件, 并且命令处理相关的文件以
cmd
开头, 例如STRING
相关的命令, 文件名cmd_kv.cc
和cmd_kv.h
,HASH
相关的命令cmd_hash.cc
,cmd_hash.h
实现步骤
The text was updated successfully, but these errors were encountered: