key_value_service 0.1.4

A refreshingly simple data-driven game engine and app framework
Documentation

[WIP] KVS

Key Value Services is a cli tools that help to you create your Key-Value store services.

Motivation

I want to create a content sharing tool that is managed by only one person and readable by many people in a secure network environment, so that I can use some common content in the terminal.

Install

cargo install key_value_service

Usage

  1. Start kvs in your server
> kvs start
2022-03-18T15:59:26.503861Z  INFO starting with 0.0.0.0:8888 successfully!
  1. Login the kvs services from client
> kvs -r 0.0.0.0:8888 login
2022-03-18T16:05:05.022305Z  INFO Token: FAAAAAAAAACUH40t6d+A9jzhexGHktUINvWwL317xp1/AQAAFAAAAAAAAACrtlLcjeSqhMZCj5rnNn2hkf0K/w==
2022-03-18T16:05:05.022393Z  INFO Save Token file to: .kvs/token
  1. Create a private key value
> kvs create foo "hello world"

default, kvs will encrypt the value use your priv_key in local. Remote just judge the key's owner. The decryption process needs to be completed by the client itself.

  1. Read a key
> kvs read foo
hello world
  1. Create a public key value
> kvs create priv_foo "priv hello world" -p

If you just do. kvs will send the value and save value as plaintext in remote.

  1. Read a private key
> kvs cat priv_foo
priv hello world
  1. Delete a Key
> kvs delete priv_foo

You just can delete key that owner is you.

  1. Update a Key
kvs create priv_foo "this is change data"
kvs read priv_foo
this is change data
  1. show remote info
> kvs remote
0.1.3
  1. show local info
> kvs local
scope: 0x1787994613fcb544bcc8ef4191cda243f315ab
  1. Read other scope key
> kvs read -s 0xad359ae3e478342ed2b5512ed7ff4ebb3ceb2dd test_pub
pub content

Example

Your team have a big list of resource id.

# important_resource_id.txt
...
A7EB0B7B-3E27-4531-B239-750300EE8D0C
B9164246-49E3-45F1-A8CE-D871CEBE3971
92312D9B-B2D8-4A92-B7B5-9A5491FF9BEC
8E1B24ED-0023-45E0-BF34-1548C8D8884D
...

Some times, the team member need create the url by the big list.

# important_resource_urls.txt
...
http://xxx.xxx.xxx.xxx/app/goods/A7EB0B7B-3E27-4531-B239-750300EE8D0C
http://xxx.xxx.xxx.xxx/app/goods/B9164246-49E3-45F1-A8CE-D871CEBE3971
http://xxx.xxx.xxx.xxx/app/goods/92312D9B-B2D8-4A92-B7B5-9A5491FF9BEC
http://xxx.xxx.xxx.xxx/app/goods/8E1B24ED-0023-45E0-BF34-1548C8D8884D
...

Let's assume we have written a command line tool named transform to handle this case.

cat important_resource_urls.txt | transform

The question is, how do I share important_resource_urls.txt with other team members.

Granted, there are many ways to share it. But you can fast finish it if you use the kvs.

# create the key
kvs create important_resource_urls -f important_resource_urls.txt

# and then, other team member can use it.
kvs cat important_resource_urls | transform

Road Map

  • [*] add set and get command to config some value in client local
  • add upload command to upload all file in current directory and use the relative directory as key.
  • add set command to set the config in client local.