diff options
author | antirez <antirez@gmail.com> | 2017-10-03 11:42:08 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2017-12-01 10:24:24 +0100 |
commit | 5082ec6419e58b59ac5f911c353276bf1340a9fd (patch) | |
tree | 22e64d93b454284ce079e8566155e9485f010754 /tests | |
parent | 50595a58898474acf12e33137a83d4201b4b2d29 (diff) | |
download | redis-5082ec6419e58b59ac5f911c353276bf1340a9fd.tar.gz |
Streams: move ID ms/seq separator from '.' to '-'
After checking with the community via Twitter (here:
https://twitter.com/antirez/status/915130876861788161) the verdict was to
use ":". However I later realized, after users lamented the fact that
it's hard to copy IDs just with double click, that this was the reason
why I moved to "." in the first instance. Fortunately "-", that was the
other option with most votes, also gets selected with double click on
most terminal applications on Linux and MacOS.
So my reasoning was:
1) We can't retain "." because it's actually confusing to newcomers, it
looks like a floating number, people may be tricked into thinking they
can order IDs numerically as floats.
2) Moving to a double-click-to-select format is much better. People will
work with such IDs for long time when coding / debugging. Why making now
a choice that will impact this for the next years?
The only other viable option was "-", and that's what I did. Thanks.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/type/stream.tcl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/unit/type/stream.tcl b/tests/unit/type/stream.tcl index e9f187ae2..06f31e08c 100644 --- a/tests/unit/type/stream.tcl +++ b/tests/unit/type/stream.tcl @@ -1,8 +1,8 @@ # return value is like strcmp() and similar. proc streamCompareID {a b} { if {$a eq $b} {return 0} - lassign [split $a .] a_ms a_seq - lassign [split $b .] b_ms b_seq + lassign [split $a -] a_ms a_seq + lassign [split $b -] b_ms b_seq if {$a_ms > $b_ms} {return 1} if {$a_ms < $b_ms} {return -1} # Same ms case, compare seq. @@ -14,9 +14,9 @@ proc streamCompareID {a b} { # Note that this function does not care to handle 'seq' overflow # since it's a 64 bit value. proc streamNextID {id} { - lassign [split $id .] ms seq + lassign [split $id -] ms seq incr seq - join [list $ms $seq] . + join [list $ms $seq] - } # Generate a random stream entry ID with the ms part between min and max @@ -24,12 +24,12 @@ proc streamNextID {id} { # XRANGE against a Tcl implementation implementing the same concept # with Tcl-only code in a linear array. proc streamRandomID {min_id max_id} { - lassign [split $min_id .] min_ms min_seq - lassign [split $max_id .] max_ms max_seq + lassign [split $min_id -] min_ms min_seq + lassign [split $max_id -] max_ms max_seq set delta [expr {$max_ms-$min_ms+1}] set ms [expr {$min_ms+[randomInt $delta]}] set seq [randomInt 1000] - return $ms.$seq + return $ms-$seq } # Tcl-side implementation of XRANGE to perform fuzz testing in the Redis |