You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lay groundwork for RESP3 support and flat ChannelHandler hierarchy
## Motivation
Since Redis 6.0, a new serialization protocol format (v3) is available that gives richer semantic reasoning behind the different types to enable commands to better understand the return types to provide in their programming language.
In addition, the `RESPTranslator` type is going to see more direct usage, and the current API doesn't make read well.
## Changes
- Add: Internal `RESPVersion` enum that the `RESPTranslator` will start to use
- Rename: `RESPTranslator.parseBytes` to `RESPTranslator.read(from:)`
Copy file name to clipboardExpand all lines: Sources/RediStack/RESP/RESPTranslator.swift
+89-68
Original file line number
Diff line number
Diff line change
@@ -15,18 +15,96 @@
15
15
importprotocol Foundation.LocalizedError
16
16
import NIOCore
17
17
18
+
extensionUInt8{
19
+
staticletnewline=UInt8(ascii:"\n")
20
+
staticletcarriageReturn=UInt8(ascii:"\r")
21
+
staticletdollar=UInt8(ascii:"$")
22
+
staticletasterisk=UInt8(ascii:"*")
23
+
staticletplus=UInt8(ascii:"+")
24
+
staticlethyphen=UInt8(ascii:"-")
25
+
staticletcolon=UInt8(ascii:":")
26
+
}
27
+
28
+
// This is not ready for prime-time
29
+
30
+
/// An exhaustive list of the available versions of the Redis Serialization Protocol.
31
+
/// - Warning: These values are not generally intended to be used outside of this library,
32
+
/// so no guarantees to source stability are given.
33
+
fileprivateenumRESPVersion{
34
+
/// The RESP version first made available in Redis 1.2.
35
+
///
36
+
/// It was made the default version in Redis 2.0.
37
+
case v2
38
+
/// The RESP version first made available in Redis 6.0.
39
+
case v3
40
+
}
41
+
42
+
extensionRESPTranslator{
43
+
/// Possible errors thrown while parsing RESP messages.
44
+
/// - Important: Any of these errors should be considered a **BUG**.
45
+
///
46
+
/// Please file a bug at [https://www.gitlab.com/swift-server-community/RediStack/-/issues](https://www.gitlab.com/swift-server-community/RediStack/-/issues).
0 commit comments