public class RedisStateMachine extends Object
| Constructor and Description |
|---|
RedisStateMachine(ByteBufAllocator alloc)
Initialize a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the state machine to free resources.
|
boolean |
decode(ByteBuf buffer,
CommandOutput<?,?,?> output)
Decode a command using the input buffer.
|
boolean |
decode(ByteBuf buffer,
RedisCommand<?,?,?> command,
CommandOutput<?,?,?> output)
Attempt to decode a redis response and return a flag indicating whether a complete response was read.
|
ProtocolVersion |
getProtocolVersion() |
boolean |
isDiscoverProtocol() |
void |
reset()
Reset the state machine.
|
protected void |
safeMultiArray(CommandOutput<?,?,?> output,
int count,
RedisCommand<?,?,?> command)
Safely sets
CommandOutput.multiArray(int). |
protected void |
safeMultiMap(CommandOutput<?,?,?> output,
int count,
RedisCommand<?,?,?> command)
Safely sets
CommandOutput.multiMap(int). |
protected void |
safeMultiPush(CommandOutput<?,?,?> output,
int count,
RedisCommand<?,?,?> command)
Safely sets
CommandOutput.multiPush(int). |
protected void |
safeMultiSet(CommandOutput<?,?,?> output,
int count,
RedisCommand<?,?,?> command)
Safely sets
CommandOutput.multiSet(int). |
protected void |
safeSet(CommandOutput<?,?,?> output,
boolean value,
RedisCommand<?,?,?> command)
Safely sets
CommandOutput.set(boolean). |
protected void |
safeSet(CommandOutput<?,?,?> output,
ByteBuffer bytes,
RedisCommand<?,?,?> command)
Safely sets
CommandOutput.set(ByteBuffer). |
protected void |
safeSet(CommandOutput<?,?,?> output,
double number,
RedisCommand<?,?,?> command)
Safely sets
CommandOutput.set(double). |
protected void |
safeSet(CommandOutput<?,?,?> output,
long number,
RedisCommand<?,?,?> command)
Safely sets
CommandOutput.set(long). |
protected void |
safeSetBigNumber(CommandOutput<?,?,?> output,
ByteBuffer bytes,
RedisCommand<?,?,?> command)
Safely sets
CommandOutput.set(ByteBuffer). |
protected void |
safeSetError(CommandOutput<?,?,?> output,
ByteBuffer bytes,
RedisCommand<?,?,?> command)
Safely sets
CommandOutput.setError(ByteBuffer). |
protected void |
safeSetSingle(CommandOutput<?,?,?> output,
ByteBuffer bytes,
RedisCommand<?,?,?> command)
Safely sets
CommandOutput.set(ByteBuffer). |
void |
setProtocolVersion(ProtocolVersion protocolVersion) |
public RedisStateMachine(ByteBufAllocator alloc)
public boolean isDiscoverProtocol()
public ProtocolVersion getProtocolVersion()
public void setProtocolVersion(ProtocolVersion protocolVersion)
public boolean decode(ByteBuf buffer, CommandOutput<?,?,?> output)
buffer - Buffer containing data from the server.output - Current command output.public boolean decode(ByteBuf buffer, RedisCommand<?,?,?> command, CommandOutput<?,?,?> output)
buffer - Buffer containing data from the server.command - the command itself TODO: Change to Consumeroutput - Current command output.public void reset()
public void close()
protected void safeSet(CommandOutput<?,?,?> output, boolean value, RedisCommand<?,?,?> command)
CommandOutput.set(boolean). Completes a command exceptionally in case an exception occurs.output - value - command - protected void safeSet(CommandOutput<?,?,?> output, long number, RedisCommand<?,?,?> command)
CommandOutput.set(long). Completes a command exceptionally in case an exception occurs.output - number - command - protected void safeSet(CommandOutput<?,?,?> output, double number, RedisCommand<?,?,?> command)
CommandOutput.set(double). Completes a command exceptionally in case an exception occurs.output - number - command - protected void safeSet(CommandOutput<?,?,?> output, ByteBuffer bytes, RedisCommand<?,?,?> command)
CommandOutput.set(ByteBuffer). Completes a command exceptionally in case an exception occurs.output - bytes - command - protected void safeSetSingle(CommandOutput<?,?,?> output, ByteBuffer bytes, RedisCommand<?,?,?> command)
CommandOutput.set(ByteBuffer). Completes a command exceptionally in case an exception occurs.output - bytes - command - protected void safeSetBigNumber(CommandOutput<?,?,?> output, ByteBuffer bytes, RedisCommand<?,?,?> command)
CommandOutput.set(ByteBuffer). Completes a command exceptionally in case an exception occurs.output - bytes - command - protected void safeMultiArray(CommandOutput<?,?,?> output, int count, RedisCommand<?,?,?> command)
CommandOutput.multiArray(int). Completes a command exceptionally in case an exception occurs.output - count - command - protected void safeMultiPush(CommandOutput<?,?,?> output, int count, RedisCommand<?,?,?> command)
CommandOutput.multiPush(int). Completes a command exceptionally in case an exception occurs.output - count - command - protected void safeMultiSet(CommandOutput<?,?,?> output, int count, RedisCommand<?,?,?> command)
CommandOutput.multiSet(int). Completes a command exceptionally in case an exception occurs.output - count - command - protected void safeMultiMap(CommandOutput<?,?,?> output, int count, RedisCommand<?,?,?> command)
CommandOutput.multiMap(int). Completes a command exceptionally in case an exception occurs.output - count - command - protected void safeSetError(CommandOutput<?,?,?> output, ByteBuffer bytes, RedisCommand<?,?,?> command)
CommandOutput.setError(ByteBuffer). Completes a command exceptionally in case an exception occurs.output - bytes - command - Copyright © 2020 lettuce.io. All rights reserved.