Subject: [Rift] Suggestion to update encoding schema to tighten KV and accomodate KV draft

From: Tony Przygienda <[email-masked]>
Date: Tue, 16 Mar 2021 13:12:49 +0100

Given we start now to precisely define the KV and it's last chance to
adjust rift schema before RFC I fine-tooth combed the spec and see that we
use string for key/value which is _almost_ but not same as binary in thrift
(it matters is some programming languages since they interpret string as
"valid UTF-8"). Hence I propose following change to schema to fix key @ 32
bits as KV draft suggests and get the value to binary, i.e. not necessarily
UTF-8 since we want to e.g. encode thrift objects in values

suggestions? observations?

-- tony

index 1f1192b..0a7b5d6 100644
--- a/src/models/encoding.thrift
+++ b/src/models/encoding.thrift
@@ -11,9 +11,9 @@
namespace py encoding

/** Represents protocol encoding schema major version */
-const common.VersionType protocol_major_version = 4
+const common.VersionType protocol_major_version = 5
/** Represents protocol encoding schema minor version */
-const common.MinorVersionType protocol_minor_version =  3
+const common.MinorVersionType protocol_minor_version =  0

/** Common RIFT packet header. */
struct PacketHeader {
@@ -378,7 +378,7 @@ struct PrefixTIEElement {
struct KeyValueTIEElement {
    /** @note: if the same key repeats in multiple TIEs of same node
        or with different values, behavior is unspecified */
-    1: required map<common.KeyIDType,string>    keyvalues;
+    1: required map<common.KeyIDType, binary>    keyvalues;
} (python.immutable = "")

diff --git a/src/models/common.thrift b/src/models/common.thrift
index d177f1e..10908e2 100644
--- a/src/models/common.thrift
+++ b/src/models/common.thrift
@@ -50,7 +50,7 @@ typedef i32      LabelType
/** @note MUST be interpreted in implementation as unsigned */
typedef i32      BandwithInMegaBitsType
/** @note Key Value key ID type */
-typedef string   KeyIDType
+typedef i32      KeyIDType