
com.alachisoft.ncache.client.internal.command.ListRemoveWithIndexCommand Maven / Gradle / Ivy
package com.alachisoft.ncache.client.internal.command;
import Alachisoft.NCache.Common.DataTypes.List.ListInsertWithIndexOperation;
import Alachisoft.NCache.Common.DataTypes.List.ListRemoveWithIndexOperation;
import com.alachisoft.ncache.common.protobuf.ListCommandProtocol;
import com.alachisoft.ncache.common.protobuf.ListRemoveWithPivotProtocol;
public class ListRemoveWithIndexCommand extends ListCommandBase {
private ListRemoveWithIndexOperation.OpType _operationType;
private int _arg1;
private int _arg2;
private ListRemoveWithPivotProtocol.ListRemoveWithIndex.Builder _listRemoveWithIndexCommandBuilder;
public ListRemoveWithIndexCommand(ListRemoveWithIndexOperation operation)
{
super.name = "ListRemoveWithIndex";
super.key = operation.getName();
_writeThruOption = operation.getWriteThruOptions();
_lockId = (String)operation.getLockId();
_lockTimeout = operation.getLockTimeout();
_operationType = operation.getOperationType();
_arg1 = operation.getArg1();
_arg2 = operation.getArg2();
}
@Override
public RequestType getCommandRequestType()
{
return RequestType.KeyBulkWrite;
}
@Override
public CommandType getCommandType()
{
return CommandType.DATA_TYPE;
}
@Override
protected void createCommand()
{
_listRemoveWithIndexCommandBuilder = ListRemoveWithPivotProtocol.ListRemoveWithIndex.newBuilder();
_listRemoveWithIndexCommandBuilder.setStart(_arg1);
_listRemoveWithIndexCommandBuilder.setEnd(_arg2);
switch (_operationType)
{
case Trim:
_listRemoveWithIndexCommandBuilder.setMethod(ListRemoveWithPivotProtocol.ListRemoveWithIndex.Method.TRIM);
break;
case RemoveRange:
_listRemoveWithIndexCommandBuilder.setMethod(ListRemoveWithPivotProtocol.ListRemoveWithIndex.Method.REMOVERANGE);
break;
case RemoveAt:
_listRemoveWithIndexCommandBuilder.setMethod(ListRemoveWithPivotProtocol.ListRemoveWithIndex.Method.REMOVEAT);
break;
}
super.createCommand();
_listCommandBuilder.setType(ListCommandProtocol.ListCommand.Type.LIST_REMOVE_WITH_INDEX);
_listCommandBuilder.setListRemoveWithIndex(_listRemoveWithIndexCommandBuilder);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy