Class RedisStateMachine


  • public class RedisStateMachine
    extends Object
    State machine that decodes redis server responses encoded according to the Unified Request Protocol (RESP). Supports RESP2 and RESP3. Initialized with protocol discovery.
    Author:
    Will Glozer, Mark Paluch, Helly Guo, shikharid
    • Constructor Detail

      • RedisStateMachine

        public RedisStateMachine()
        Initialize a new instance.
    • Method Detail

      • isDiscoverProtocol

        public boolean isDiscoverProtocol()
      • setProtocolVersion

        public void setProtocolVersion​(ProtocolVersion protocolVersion)
      • decode

        public boolean decode​(ByteBuf buffer,
                              CommandOutput<?,​?,​?> output)
        Decode a command using the input buffer.
        Parameters:
        buffer - Buffer containing data from the server.
        output - Current command output.
        Returns:
        true if a complete response was read.
      • decode

        public boolean decode​(ByteBuf buffer,
                              CommandOutput<?,​?,​?> output,
                              Consumer<Exception> errorHandler)
        Attempt to decode a redis response and return a flag indicating whether a complete response was read.
        Parameters:
        buffer - Buffer containing data from the server.
        output - Current command output.
        errorHandler - the error handler
        Returns:
        true if a complete response was read.
      • reset

        public void reset()
        Reset the state machine.
      • close

        public void close()
        Close the state machine to free resources.