Skip to content

Recipe: Niovakv Single Key Write Read

Paul Nowoczynski edited this page Sep 29, 2021 · 1 revision

Niovakv Single Key Write Read

Parent recipe: “Basic Recipe For Niovakv”

Make sure app_name=niovakv while running the recipe.

Objective:

Perform single key write and read through niovakv client. Verify that the write and read operation is happening successfully.

1 - Export path

export CGO_LDFLAGS="-L/usr/local/niova/niova-core/lib/"
export CGO_CFLAGS="-I/usr/local/niova/niova-core/include/niova"
export LD_LIBRARY_PATH=/usr/local/niova/niova-core/lib/
export PATH=$PATH:/usr/local/go/bin
export PYTHONPATH=/usr/local/holon/holon
export NIOVA_BIN_PATH=/usr/local/niova//niova-core/libexec/niova

2 - Check if app_type is “niovakv”

3 - Start niovakv server

  • Internally this will start a PMDB Client.

4 - Start niovakv client by passing key-value pairs

Perform write operation

Here to start niovakv client we need to pass various parameters for write operation. Since niovakv client will write the key-value sequentially and then it will read the written values.

Operation : "write"
Key : <key-prefix>
Value : <value-prefix>
OutfileName : <abc>
NumRequest : <how many request to process> here it will be 1
MultiKey : False
Sequential : False

4a - Verifications

Verify if write operation is successful

  • “Status” for write operation should be 0.
"write": [
  {
   "Request": {
    "Operation": "write",
    "Key": "russia1",
    "Value": "sputnic1", 
    "Request_timestamp": "2021-09-23T11:15:20.573363806Z"
   },
   "Response": {
    "Status": 0,
    "Response": "",
    "Validate": true,
    "Response_timestamp": "2021-09-23T11:15:20.636067207Z"
   },
   "Req_resolved_time": 62703555
  },

5. Perform read operation

Operation : "read"
Key : <key-prefix>
Value : <value-prefix>
OutfileName : <abc>
NumRequest : <how many request to process> here it will be 1
MultiKey : False
Sequential : False

After the read operation, take the values.

{
 "read": [
  {
   "Request": {
    "Operation": "read",
    "Key": "russia1",
    "Value": "",
    "Request_timestamp": "2021-09-23T11:15:22.112547337Z"
   },
   "Response": {
    "Status": 0,
    "Response": "sputnic1",
    "Validate": true,
    "Response_timestamp": "2021-09-23T11:15:22.114034244Z"
   },
   "Req_resolved_time": 1486901
  },

Compare values of read and write

  • [‘write’][‘Request’][‘Value’] == [‘read’][‘Response’][‘Response’]

Verify if the read operation is successful.

  • “Status” for read operation should be 0.
Clone this wiki locally