@@ -42,11 +42,34 @@ message KVRead {
42
42
Version version = 2 ;
43
43
}
44
44
45
+ // KVMetadataWrite captures changes to metadata of a KVS key.
46
+ // If KeepExistingMetadata is true, it is implied that metadata of the
47
+ // previous version of this KVS key should be used, otherwise
48
+ // they should be updated to the value specified in Metadata.
49
+ message KVMetadataWrite {
50
+ bytes metadata = 1 ;
51
+ bool keep_existing_metadata = 2 ;
52
+ }
53
+
45
54
// KVWrite captures a write (update/delete) operation performed during transaction simulation
55
+ // Four operations are supported:
56
+ // 1) value update: if KeepExistingValue is false, the value is updated to Value.
57
+ // 2) metadata update: if Metadata.KeepExistingMetadata is false, the metadata
58
+ // is updated to Metadata.Metadata
59
+ // 3) medatadata deletion: if Metadata is nil, metadata is deleted
60
+ // 4) deletion: if IsDelete is set, this key is removed from the ledger
61
+ // Note that 1 and 2 may be combined.
46
62
message KVWrite {
47
63
string key = 1 ;
48
64
bool is_delete = 2 ;
49
65
bytes value = 3 ;
66
+ // The two values below have been added in v1.2. Note that their zero value
67
+ // describes a behaviour which is consistent with that of of pre-1.2 code:
68
+ // - if KeepExistingValue is false, the value is updated to Value (unless
69
+ // IsDelete is true).
70
+ // - if Metadata is nil, metadata is deleted for this KVS key.
71
+ bool keep_existing_value = 4 ;
72
+ KVMetadataWrite metadata = 5 ;
50
73
}
51
74
52
75
// KVReadHash is similar to the KVRead in spirit. However, it captures the hash of the key instead of the key itself
@@ -57,11 +80,15 @@ message KVReadHash {
57
80
Version version = 2 ;
58
81
}
59
82
60
- // KVWriteHash is similar to the KVWrite in spiritcaptures a write (update/delete) operation performed during transaction simulation
83
+ // KVWriteHash is similar to the KVWrite. It captures a write (update/delete) operation performed during transaction simulation
84
+ // for a hashed key and to a hashed value. Note that metadata are stored in cleartext (no hash).
85
+ // Similar considerations to KVWrite apply here.
61
86
message KVWriteHash {
62
87
bytes key_hash = 1 ;
63
88
bool is_delete = 2 ;
64
89
bytes value_hash = 3 ;
90
+ bool keep_existing_value = 4 ;
91
+ KVMetadataWrite metadata = 5 ;
65
92
}
66
93
67
94
// Version encapsulates the version of a Key
0 commit comments