> 无意间看到一个类似redis的项目:rosedb。之前一直想自己写点轮子,一直没有行动,可能是现有的轮子用的太舒服了,没有动力去实现一个新的轮子。 先在别人的项目上提交点代码吧。
### rosedb简单演示:
>redis是c语言写的,rosedb是golang写的,我比较希望golang可以出现一个类似redis性能的项目。rosedb效果如下:
服务器端:
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210703120933580.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2phY2t5MTI4MjU2,size_16,color_FFFFFF,t_70)
客户端:
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210703120958998.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2phY2t5MTI4MjU2,size_16,color_FFFFFF,t_70)
### 将linux开发机的公钥添加到github的白名单中:
**创建rsa密钥对:**
```shell
root@ubuntu:~/rosedb# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ztWFSQsqHKC3zri+f70X3wRAq83RyBiodQ2XZ3tdSiY root@ubuntu
The key's randomart image is:
+---[RSA 2048]----+
| ....o++.. |
| . .o..*+*E+o .|
| . .oo.o =+==.o.|
| ... . + oo.o .|
| . S + .o |
| + o .. . |
| . o .o o o |
| . . . . . . |
| .+o.. .o |
+----[SHA256]-----+
root@ubuntu:~/rosedb#
```
**复制 linux公钥:**
```shell
root@ubuntu:~/rosedb# cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3l+FZ64/0zHdKR/8U9OJFveAWnbyLVMhMWmiDpssuqijRTKffO1AeuLwrUZE3BXOwkdzR7LBREHHtIYb1Yd9Xw25wx1bRKYr8kEMSJg5i/w+cSPs3NH/AkYt4xvihjPilgu1eBuD2X5bPRiNiERCb2aCOJgXXqaVDeOSEd64LTvYWYxpTdDnF6v4yXn4KxwiuKhklDLCyT+OgbVF8O7+IFGbvs+3wFPBH6dn/8dXf2jy0s4FUeZStzGvBb1lTpJMI9swJNl9Jh+gZKYEfwyWrSUqRrwS+YcXKiT8V2FS5THd7sLrlTYMseR66TgsP16+YT/6e0ZE1M8Ln7kIY2oG5 root@ubuntu
root@ubuntu:~/rosedb#
```
![在这里插入图片描述](https://img-blog.csdnimg.cn/2021070311420559.png)
**添加公钥到github 的步骤**
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210703114327642.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2phY2t5MTI4MjU2,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210703114418360.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2phY2t5MTI4MjU2,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210703114611185.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2phY2t5MTI4MjU2,size_16,color_FFFFFF,t_70)
### 项目地址:
```shell
https://github.com/roseduan/rosedb
```
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210703112423281.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2phY2t5MTI4MjU2,size_16,color_FFFFFF,t_70)
### 下载代码到本地:
```shell
root@ubuntu:~# git clone git@github.com:pony9033/rosedb.git
Cloning into 'rosedb'...
remote: Enumerating objects: 904, done.
remote: Counting objects: 100% (317/317), done.
remote: Compressing objects: 100% (206/206), done.
remote: Total 904 (delta 181), reused 211 (delta 104), pack-reused 587
Receiving objects: 100% (904/904), 509.31 KiB | 554.00 KiB/s, done.
Resolving deltas: 100% (541/541), done.
root@ubuntu:~# cd rosedb/
root@ubuntu:~/rosedb#
```
### 查看本地分支:
```shell
root@ubuntu:~/rosedb# git branch
* main
root@ubuntu:~/rosedb#
```
### 创建一个临时分支:
```shell
root@ubuntu:~/rosedb# git checkout -b jack
root@ubuntu:~/rosedb# git branch
* jack
main
root@ubuntu:~/rosedb#
```
### 创建于上游项目的链接,这里上游指的是一开始fork的那个项目源https://github.com/roseduan/rosedb.git
```shell
root@ubuntu:~/rosedb# git remote add upstream https://github.com/roseduan/rosedb.git
root@ubuntu:~/rosedb# git remote -v
origin git@github.com:pony9033/rosedb.git (fetch)
origin git@github.com:pony9033/rosedb.git (push)
upstream https://github.com/roseduan/rosedb.git (fetch)
upstream https://github.com/roseduan/rosedb.git (push)
root@ubuntu:~/rosedb#
```
### 修改代码:
```shell
root@ubuntu:~/rosedb# git status
On branch jack
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: storage/db_file.go
no changes added to commit (use "git add" and/or "git commit -a")
root@ubuntu:~/rosedb#
```
### 提交代码:
```shell
root@ubuntu:~/rosedb# git add .
root@ubuntu:~/rosedb# git commit -m "修改db_file.go,数据库文件加载时,文件名解析何发现判断"
[jack 3dcda2c] 修改db_file.go,数据库文件加载时,文件名解析何发现判断
1 file changed, 17 insertions(+), 8 deletions(-)
root@ubuntu:~/rosedb#
root@ubuntu:~/rosedb# git log
commit 3dcda2cea0f81b493a91ccc33c7d51429f370377 (HEAD -> jack)
Author: jacky <1650727278@qq.com>
Date: Sat Jul 3 11:10:04 2021 +0800
修改db_file.go,数据库文件加载时,文件名解析何发现判断
commit 8125d9e480a199a0dac5b0c9c00d2b4f3321806f (tag: v1.2.8, origin/master, origin/main, origin/HEAD, main, develop)
Author: roseduan <roseduan7@163.com>
Date: Fri Jul 2 13:23:10 2021 +0800
[fix] str set err.
commit 31d9972b61fd8b8e6b8c417743fabba654b4cf10 (origin/develop)
Merge: 8832903 73e0cb3
Author: roseduan <roseduan520@gmail.com>
Date: Fri Jul 2 09:33:09 2021 +0800
Merge pull request #18 from nc-77/main
fix sdiff bug and add more tests
commit 73e0cb37b9f5410ee77720574910c4c10e13624d
```
### 把本地提交的代码推送到自己的github分支
```shell
root@ubuntu:~/rosedb# git push origin jack
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 613 bytes | 306.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To github.com:pony9033/rosedb.git
* [new branch] jack -> jack
root@ubuntu:~/rosedb#
```
### 在自己的github找到刚才的修改(这里是jack分支),创建pr:
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210703120627312.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2phY2t5MTI4MjU2,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210703113309140.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2phY2t5MTI4MjU2,size_16,color_FFFFFF,t_70)
### 去github开源项目地址,查看本次pr的进度
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210703113622346.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2phY2t5MTI4MjU2,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210703113740386.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2phY2t5MTI4MjU2,size_16,color_FFFFFF,t_70)
状态现实还在等待审核中。
### 点击查看修改内容:
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210703113852597.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2phY2t5MTI4MjU2,size_16,color_FFFFFF,t_70)
有疑问加站长微信联系(非本文作者))