Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds RESP3 to protocol specification #2120

Merged
merged 35 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a2089da
Adds RESP3 to protocol specification
itamarhaber Sep 13, 2022
2f07005
Spelling and whitelisting
itamarhaber Sep 13, 2022
ebaa2b7
Edits
itamarhaber Sep 13, 2022
42db0a8
Typo
itamarhaber Sep 13, 2022
cea81c7
Apply suggestions from code review
itamarhaber Dec 29, 2022
4a14719
Merge branch 'master' into fix-1920
itamarhaber Dec 29, 2022
8e0dcb6
Applies code review comments
itamarhaber Dec 29, 2022
fb3c92c
Edit
itamarhaber Dec 29, 2022
10f3d7e
worlist and edits
itamarhaber Dec 29, 2022
88bddcc
Adds NaNs
itamarhaber Dec 30, 2022
a840f7b
Edits
itamarhaber Dec 30, 2022
8ebebbd
Renames blob error to bulk error
itamarhaber Dec 30, 2022
554536a
wordlist
itamarhaber Dec 30, 2022
c7d58c8
Renames errors to simple errors
itamarhaber Dec 30, 2022
7b57825
Normalize ~nAn
itamarhaber Jan 5, 2023
25310cf
Adds protected-mode protocol exception
itamarhaber Feb 28, 2023
9012299
Wordlist
itamarhaber Feb 28, 2023
8655530
Review suggestion
itamarhaber Feb 28, 2023
d6bf3e3
Adds RESP2 map pattern
itamarhaber Mar 12, 2023
7abae3e
Adds double exponent part
itamarhaber Mar 12, 2023
0435303
Reverts fat thumbs
itamarhaber Mar 12, 2023
05e458a
Adds a singular tips
itamarhaber Mar 15, 2023
01da619
Update docs/reference/protocol-spec.md
itamarhaber Mar 15, 2023
6280997
Exponent optionality
itamarhaber Mar 15, 2023
bb11d60
Align
itamarhaber Mar 15, 2023
d921e47
CRLF
itamarhaber Mar 15, 2023
60770f3
uNDO
itamarhaber Mar 15, 2023
58c690a
Parameterize it
itamarhaber Mar 15, 2023
b324085
Wordlist
itamarhaber Mar 15, 2023
3e3cb2b
Breaks down integer's and double's encodings
itamarhaber Mar 15, 2023
fd32f3d
Make it formal, ASCII, base-10 crystal clear
itamarhaber Mar 16, 2023
9ad2bd4
Excludes streaming types
itamarhaber Mar 16, 2023
6482f97
Update docs/reference/protocol-spec.md
itamarhaber Mar 17, 2023
23ae7ec
CR https://github.com/redis/redis-doc/pull/2120#discussion_r1140109937
itamarhaber Mar 17, 2023
03e1905
Merge branch 'master' into fix-1920
itamarhaber Aug 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions docs/reference/protocol-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,15 @@ Also, simpler client implementations can return a generic error value, such as `

### Integers
This type is a CRLF-terminated string that represents a signed 64-bit integer.
Its encoding is prefixed by a colon (`:`) byte.

RESP encodes integers in the following way:

:[<sign>]<integer>\r\n

* The colon (`:`) as the first byte.
* An optional plus (`+`) or minus (`-`) as the sign.
* One or more decimal digits (`0`..`9`) as the integer's value.
* The CRLF terminator.

For example, `:0\r\n` and `:1000\r\n` are integer replies (of zero and one thousand, respectively).

Expand Down Expand Up @@ -354,29 +362,19 @@ RESP booleans are encoded as follows:
The Double RESP type encodes a double-precision floating point value.
Doubles are encoded as follows:

,<floating-point-number>\r\n
,[<sign>]<integral>[.<fractional>][<E|e>[sign]<exponent>]\r\n
itamarhaber marked this conversation as resolved.
Show resolved Hide resolved

* The comma character (`,`) as the first byte.
* The floating point number.
* An optional plus (`+`) or minus (`-`) as the sign.
* The integral value that's represented by one or more decimal digits (`0`..`9`).
* The optional fractional value that's represented by a dot (`.`), followed by one or more decimal digits (`0`..`9`).
* The optional exponent value begins with a capital or lowercase letter E (`E` or `e`), followed by an optional plus (`+`) or minus (`-`) as the exponent's sign, ending with one or more decimal digits (`0`..`9`).
* The CRLF terminator.

Here's the encoding of the number 1.23:

,1.23\r\n

A floating point number may be made up of up to three parts:

<integral-part>[.<fractional-part>][<exponent-part]

The floating point number always begins with an integral.
The integral part is made of one or more decimal digits.

A fractional part may follow the integral.
The fractional part begins with a dot (`.`), followed by one or more decimal digits.

An exponent part may appear at the end of the number.
The exponent part begins with the letters `E` or `e`, an optional `+` or `-`, followed by one or more decimal digits.

Because the fractional part is optional, the integer value of ten (10) can, therefore, be RESP-encoded both as an integer as well as a double:

:10\r\n
Expand Down Expand Up @@ -683,4 +681,4 @@ While comparable in performance to a binary protocol, the Redis protocol is sign

* For testing purposes, use [Lua's type conversions](/topics/lua-api#lua-to-resp3-type-conversion) to have Redis reply with any RESP2/RESP3 needed.
As an example, a RESP3 double can be generated like so:
EVAL "return { double = tonumber(ARGV[1]) }" 0 6.379e-5
EVAL "return { double = tonumber(ARGV[1]) }" 0 1e0
1 change: 1 addition & 0 deletions wordlist
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ tmp
tmux
toolkits
topologies
tonumber
tradeoff
tradeoffs
transactional
Expand Down