Skip to content

Conform `RedisByteDecoder` to `NIOSingleStepByteToMessageDecoder`

Motivation

Traffic on the NIOChannelPipeline is not free, because of this recent NIO projects try to reduce the number of needed handlers for a given protocol. For example NIOSSH and NIOHTTP2 parse incoming bytes in the main ChannelHandler rather than within a dedicated DecoderHandler. To make this pattern easier the NIOSingleStepByteToMessageDecoder was introduced into NIO. The NIOSingleStepByteToMessageDecoder allows users to have an explicit decoder object within their main channel handler, that has the same semantics as the ByteToMessageDecoder in the channel pipeline. A usage example can be seen here:

https://github.com/vapor/postgres-nio/blob/main/Sources/PostgresNIO/New/PostgresChannelHandler.swift#L102

To allow us to move the RedisByteDecoder into the RedisChannelHandler, let's conform it to NIOSingleStepByteToMessageDecoder.

Changes

Conform RedisByteDecoder to NIOSingleStepByteToMessageDecoder. This is a non breaking change since NIOSingleStepByteToMessageDecoder has default implementations for the ByteToMessageDecoder protocol, which we continue to support.

Merge request reports

Loading