1 Star 0 Fork 0

fengyang / kv-rs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

kv

KV Storage in Rust

Components

kv: KV Storage

kv-cli: KV CLI

Platforms

Our current goal is that the following platforms will be able to run kv db.

  • Linux x86 (x86_64-unknown-linux-gnu)
  • Darwin x86 (x86_64-apple-darwin)
  • Darwin arm (aarch64-apple-darwin)

Installation for

Cargo

cargo install kvcli

Usage

kvcli

❯ ./kvcli

██  ██  █        █
██ ██   ██      ██
███      ██    ██
██ ██     ██  ██
██  ██     ████  KV Storage CLI

Welcome to kvcli.
Connecting to Client.

kvcli > 

kvcli help

❯ ./kvcli --help

██  ██  █        █
██ ██   ██      ██
███      ██    ██
██ ██     ██  ██
██  ██     ████  KV Storage CLI

A distributed kv storage CLI

Usage: kvcli [OPTIONS] [COMMAND]

Commands:
  login  👤  login sys and check user account!
  help   Print this message or the help of the given subcommand(s)

Options:
  -d, --debug                  debug model
      --help                   Print help information
  -c, --config <CONFIG>        Configuration file path [default: config/kvdb.yaml]
  -q, --quiet                  quiet model, No output printed to stdout
  -l, --log-level <LOG_LEVEL>  [default: info]
  -n, --non-interactive        Force non-interactive mode
      --query=<QUERY>          Query to execute
  -V, --version                Print version

kvcli debug

> ./kvcli -d
> ./kvcli --debug

██  ██  █        █
██ ██   ██      ██
███      ██    ██
██ ██     ██  ██
██  ██     ████  KV Storage CLI

Args { debug: true, help: false, config: "config/kvdb.yaml", cmd: None, quiet: false, log_level: "info", non_interactive: false, query: None }
ConfigLoad { version: 1, api_key: "abcd", data_dir: "/media/fengyang/App-1T/workspace/kv/storage", compact_threshold: 0.2, prompt: Some("kvcli"), show_stats: Some(false), auto_append_part_cmd: Some(false), multi_line: Some(true), replace_newline: Some(true), show_affected: Some(false), progress_color: None, show_progress: Some(false) }

Welcome to kvcli.
Connecting to Client.

kvcli > 

Grammar

语法 CMD Desc DEMO
INFO INFO 查看服务状态和相关信息 INFO
TIME TIME 返回当前服务器时间 TIME
KSIZE KSIZE 返回当前库文件的 key 的数量 KSIZE
EXIT exit 关闭当前连接 exit
SHOW SHOW DB 显示当前使用的库文件 SHOW DB
SELECT SELECT 切换到指定的库文件
SET SET 设置指定 key 的值。 SET ob "redis"
SET key 1
GET GET 获取指定 key 的值 GET ob
KEYS KEYS key list KEYS
DEL DEL DEL ob
DELETE DELETE DELETE ob
GETSET GETSET key value 将给定 key 的值设为 value ,并返回 key 的旧值(old value)。
MGET MGET key1 [key2..] 获取所有(一个或多个)给定 key 的值。
SETEX SETNX key value 只有在 key 不存在时设置 key 的值。
❯ ./kvcli

██  ██  █        █
██ ██   ██      ██
███      ██    ██
██ ██     ██  ██
██  ██     ████  KV Storage CLI

Welcome to kvcli.
Connecting to Client.

kvcli > SET order_key xxx
OK

kvcli > keys
order_key

kvcli > ksize
1

kvcli > GET order_key
xxx

kvcli > DEL order_key
OK

kvcli > GET order_key
N/A

Config

在 terminal 终端模式下, Refresh Config

CMD Desc
.show_progress 【true, false】 Show progress [bar] when executing queries. Default false
.show_stats 【true, false】 Show stats after executing queries. Only works with non-interactive mode.
.show_affected 【true, false】 Show rows affected
.auto_append_part_cmd 【true, false】 fix part cmd options. default false
.multi_line 【true, false】 Multi line mode, default is true.
.replace_newline 【true, false】 whether replace '\n' with '\n', default true.
MIT License Copyright (c) 2024 fengyang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

kv 文件存储 展开 收起
Rust
MIT
取消

发行版 (1)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
Rust
1
https://gitee.com/yueny/kv-rs.git
git@gitee.com:yueny/kv-rs.git
yueny
kv-rs
kv-rs
master

搜索帮助