Skip to content

Commit be90a60

Browse files
committedOct 5, 2017
[FAB-6323] Improve comments for tstore helper
This CR improves certain comments on store_helper.go in transientstore. Change-Id: Ia84b15158622768c15d7edbeb04aff55624e5db0 Signed-off-by: senthil <cendhu@gmail.com>
1 parent af96475 commit be90a60

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎core/transientstore/store_helper.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ func createTxidRangeEndKey(txid string) []byte {
122122
endKey = append(endKey, prwsetPrefix)
123123
endKey = append(endKey, compositeKeySep)
124124
endKey = append(endKey, []byte(txid)...)
125+
// As txid is a fixed length string (i.e., 128 bits long UUID), 0xff can be used as a stopper.
126+
// Otherwise a super-string of a given txid would also fall under the end key of range query.
125127
endKey = append(endKey, byte(0xff))
126128
return endKey
127129
}
@@ -137,7 +139,7 @@ func createPurgeIndexByHeightRangeStartKey(blockHeight uint64) []byte {
137139
return startKey
138140
}
139141

140-
// createPurgeIndexByHeightRangeStartKey returns a endKey to do a range query on index stored in transient store
142+
// createPurgeIndexByHeightRangeEndKey returns a endKey to do a range query on index stored in transient store
141143
// using blockHeight
142144
func createPurgeIndexByHeightRangeEndKey(blockHeight uint64) []byte {
143145
var endKey []byte
@@ -159,13 +161,15 @@ func createPurgeIndexByTxidRangeStartKey(txid string) []byte {
159161
return startKey
160162
}
161163

162-
// createPurgeIndexByTxidRangeStartKey returns a endKey to do a range query on index stored in transient store
164+
// createPurgeIndexByTxidRangeEndKey returns a endKey to do a range query on index stored in transient store
163165
// using txid
164166
func createPurgeIndexByTxidRangeEndKey(txid string) []byte {
165167
var endKey []byte
166168
endKey = append(endKey, purgeIndexByTxidPrefix)
167169
endKey = append(endKey, compositeKeySep)
168170
endKey = append(endKey, []byte(txid)...)
171+
// As txid is a fixed length string (i.e., 128 bits long UUID), 0xff can be used as a stopper.
172+
// Otherwise a super-string of a given txid would also fall under the end key of range query.
169173
endKey = append(endKey, byte(0xff))
170174
return endKey
171175
}

0 commit comments

Comments
 (0)
Please sign in to comment.