struct
CQL::Postgres::ProtocolVersion
- CQL::Postgres::ProtocolVersion
- Struct
- Value
- Object
Overview
A frontend/backend protocol version, and every rule that depends on it, so the rest of the driver never compares version numbers itself.
3.0 is understood by every server since PostgreSQL 7.4. 3.2 (PostgreSQL 18) enlarges the query-cancel secret key from 4 bytes to 4..256 bytes. 3.1 is reserved and never used.
Included Modules
- Comparable(CQL::Postgres::ProtocolVersion)
Defined in:
postgres/protocol_version.crConstant Summary
-
EARLIEST =
V3_0 -
KNOWN =
{V3_0, V3_2} -
LATEST =
V3_2 -
SECRET_KEY_SIZES_BEFORE_3_2 =
4..4 -
SECRET_KEY_SIZES_FROM_3_2 =
4..256 -
V3_0 =
new(3, 0) -
V3_2 =
new(3, 2)
Constructors
- .new(major : Int32, minor : Int32)
-
.parse(text : String) : ProtocolVersion
"3.0", "3.2" or "latest".
Instance Method Summary
-
#<=>(other : ProtocolVersion) : Int32
The comparison operator.
-
#code : Int32
The 32-bit number sent in the StartupMessage.
- #major : Int32
- #minor : Int32
-
#negotiated(offered : Int32) : ProtocolVersion
The version to use after the server named its newest one in NegotiateProtocolVersion.
-
#secret_key_sizes : Range(Int32, Int32)
The allowed length of the cancel secret key.
-
#to_s(io : IO) : Nil
Same as
#inspect(io). - #valid_secret_key?(key : Bytes) : Bool
Constructor Detail
Instance Method Detail
The comparison operator. Returns 0 if the two objects are equal,
a negative number if this object is considered less than other,
a positive number if this object is considered greater than other,
or nil if the two objects are not comparable.
Subclasses define this method to provide class-specific ordering.
The comparison operator is usually used to sort values:
# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]
# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]
The version to use after the server named its newest one in NegotiateProtocolVersion. The protocol says that field holds the newest minor version, but servers before PostgreSQL 18 send the whole version number (3.0 as 196608), so both forms are read.