use of org.apache.geode.redis.internal.RedisDataType in project geode by apache.
the class DelExecutor method executeCommand.
@Override
public void executeCommand(Command command, ExecutionHandlerContext context) {
if (context.hasTransaction())
throw new UnsupportedOperationInTransactionException();
List<byte[]> commandElems = command.getProcessedCommand();
if (commandElems.size() < 2) {
command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.DEL));
return;
}
int numRemoved = 0;
for (int i = 1; i < commandElems.size(); i++) {
byte[] byteKey = commandElems.get(i);
ByteArrayWrapper key = new ByteArrayWrapper(byteKey);
RedisDataType type = context.getRegionProvider().getRedisDataType(key);
if (removeEntry(key, type, context))
numRemoved++;
}
command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
}
use of org.apache.geode.redis.internal.RedisDataType in project geode by apache.
the class FlushAllExecutor method executeCommand.
@Override
public void executeCommand(Command command, ExecutionHandlerContext context) {
if (context.hasTransaction())
throw new UnsupportedOperationInTransactionException();
for (Entry<String, RedisDataType> e : context.getRegionProvider().metaEntrySet()) {
try {
String skey = e.getKey();
RedisDataType type = e.getValue();
removeEntry(Coder.stringToByteWrapper(skey), type, context);
} catch (EntryDestroyedException e1) {
continue;
}
}
command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
}
use of org.apache.geode.redis.internal.RedisDataType in project geode by apache.
the class TypeExecutor method executeCommand.
@Override
public void executeCommand(Command command, ExecutionHandlerContext context) {
List<byte[]> commandElems = command.getProcessedCommand();
if (commandElems.size() < 2) {
command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.TYPE));
return;
}
ByteArrayWrapper key = command.getKey();
RedisDataType type = context.getRegionProvider().getRedisDataType(key);
if (type == null)
command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), "none"));
else
command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), type.toString()));
}
Aggregations