RESP Arrays
RESP Arrays
There can be 2 cases:
nil
arrays, where the length is -1 and no array element is presentNon-nil Arrays can be constructed using the RESPBuilders#arr(xs: Seq[RESP]) method.
import laserdisc.protocol.RESP._ val nonNilArray: NonNilArray = arr(Vector(str("hello"), str("world"))) val guaranteedNonEmptyArray: NonNilArray = arr(str("hello"), str("world")) val emptyArray: NonNilArray = arr(Vector.empty) val nilArray: NilArray = nilArray
A forwarder for nil
is present too and represented using
the final val
s RESPBuilders.nilArray
RESPBuilders#arr(one: RESP, rest: RESP*) is an overload which supports the creation of guaranteed non-empty sequences only. This is achieved through the usage of one fixed parameter followed by a var-arg of the same
This type-class serves two purposes:
This type-class serves two purposes:
The HList that will be verified to contain only types that are subtypes of A
The minimum number of types (subtypes of A) that are needed to be present in L
The supertype of all types present in L
RESP Bulk Strings
RESP Bulk Strings
There can be 2 cases:
null
bulk strings, where the length is -1 and no actual underlying string is presentNon-null BulkStrings can be constructed using the RESPBuilders#bulk method
import laserdisc.protocol.RESP._ val nonNullBulkString: NonNullBulkString = bulk("some string") val nullBulkString: NullBulkString = nullBulk
A forwarder for null
BulkStrings is present too and represented
using the final val
s RESPBuilders.nullBulk
RESP Errors
RESP Errors
RESP Errors are also scala.RuntimeExceptions, although where possible they will not contain stacktrace data
These can be constructed by using the RESPBuilders#err method
import laserdisc.protocol.RESP._ val error: Error = err("some error message")
RESP Integers
RESP Integers
These can be constructed by using the RESPBuilders#int method
import laserdisc.protocol.RESP._ val integer: Integer = int(42)
Sometimes the values 0 and 1 are used to represent boolean
values. In this case 0 corresponds to False while 1 to True,
respectively. These are represented using the final val
s
RESPBuilders.falseI and RESPBuilders.trueI, respectively
This is the special case of a non-nil RESP Array
This is the special case of a non-nil RESP Array
These can be constructed by using the RESPBuilders#arr(xs: Seq[RESP]) method
or
by resorting to the overloaded RESPBuilders#arr(one: RESP, rest: RESP*) method which expects one parameter to be supplied followed by a (possibly empty) sequence of RESPs (vararg).
This is the special case of a non-null RESP BulkString
This is the special case of a non-null RESP BulkString
These can be constructed by using the RESPBuilders#bulk method
This sealed trait represents the entire Redis Serialization Protocol algebra
Concrete instances of this trait must be created using this trait's companion object's methods, were scodec.Codecs for each are also defined
RESP Simple Strings
RESP Simple Strings
These can be constructed by using the RESPBuilders#str method
import laserdisc.protocol.RESP._ val simpleString: SimpleString = str("some string")
Sometimes the value "OK" is used to represent a successful
acknowledgement/processing of a command. This is represented
using the final val
RESPBuilders.ok
This type-class serves two purposes:
This type-class serves two purposes:
The type we want to insert before concatenation