Skip to content

Support KV Store #124

Description

@stplaydog

Design Spec

0. Motivation

Current put_file interface only support storing value of format:

{
tag : ""
....
}

Which is value only, if we want to make query of a specific value, full chain scan not avoidable. Thus, we need to introduce KV store in our implementation.

1. put_file

We need to support put_file with data format:

{
tag : "KV",
message : 
    {
        project : "", // for multi-tenancy purposes
        key : "", // now we only have one key-column
        value: "" // content of the value, in the JSON format
    }
}

2. get_file

And we need to add a new interface get_file, with data format:

{
tag : "KV",
message : 
    {
        project : "", // for multi-tenancy purposes
        key : "", // wildcard(like xxx*) will be supported
    }
}

3. get_range

Range query will be supported with get_range, with data format:

{
tag : "KV",
message : 
    {
        project : "", // for multi-tenancy purposes
        keyUp : "", // does not support wildcard
        keyLow : "", // does not support wildcard
    }
}

Important!!

  1. This feature only works in BatchTxn mode.
  2. If there are same keys, the later one will cover the previous one, and get_range will return the latest version instead of duplicate records.
  3. Currently, there is no transaction management, if the same key is 'put' at the same time, the total order will be utilized to decide which put will be discarded.
  4. There is no access control, crypto technology can be leveraged to help protecting user data.
  5. In the future, the transaction fee feature will be included, by which the user of the chain will be charged per Kb data they put in the chain.
  6. Binary, LOB are not supported.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions