Skip to content

Commit dac89f2

Browse files
committed
add comments
1 parent c68ab0d commit dac89f2

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

storage/operation/reads_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func TestIterateInvalidRange(t *testing.T) {
7373
})
7474
}
7575

76+
// TestIterationBoundary tests that when the prefixEnd is all 1s, the iteration should include the last key
7677
func TestIterationBoundary(t *testing.T) {
7778
dbtest.RunWithStorages(t, func(t *testing.T, r storage.Reader, withWriter dbtest.WithWriter) {
7879
// Define the prefix range

storage/operations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ func OnCommitSucceed(b ReaderBatchWriter, onSuccessFn func()) {
150150
// for instance, to iterate keys between "hello" and "world",
151151
// we use "hello" as LowerBound, "worle" as UpperBound, so that "world", "world1", "worldffff...ffff"
152152
// will all be included.
153+
// In the case that the endPrefix is all 1s, such as []byte{0xff, 0xff, ...}, there is no upper-bound,
154+
// it returns (startPrefix, nil, false)
153155
func StartEndPrefixToLowerUpperBound(startPrefix, endPrefix []byte) (lowerBound, upperBound []byte, hasUpperBound bool) {
154156
// if the endPrefix is all 1s, such as []byte{0xff, 0xff, ...}, there is no upper-bound
155157
// so we return the startPrefix as the lower-bound, and nil as the upper-bound, and false for hasUpperBound

0 commit comments

Comments
 (0)