org.infinispan.hotrod.impl.operations.ContainsKeyOperation Maven / Gradle / Ivy
The newest version!
package org.infinispan.hotrod.impl.operations;
import org.infinispan.api.common.CacheOptions;
import org.infinispan.hotrod.impl.DataFormat;
import org.infinispan.hotrod.impl.protocol.HotRodConstants;
import org.infinispan.hotrod.impl.transport.netty.HeaderDecoder;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
/**
* Implements "containsKey" operation as described in Hot Rod
* protocol specification.
*
* @since 14.0
*/
public class ContainsKeyOperation extends AbstractKeyOperation {
public ContainsKeyOperation(OperationContext operationContext, K key, byte[] keyBytes, CacheOptions options, DataFormat dataFormat) {
super(operationContext, CONTAINS_KEY_REQUEST, CONTAINS_KEY_RESPONSE, key, keyBytes, options, dataFormat);
}
@Override
protected void executeOperation(Channel channel) {
scheduleRead(channel);
sendArrayOperation(channel, keyBytes);
}
@Override
public void acceptResponse(ByteBuf buf, short status, HeaderDecoder decoder) {
complete(!HotRodConstants.isNotExist(status) && HotRodConstants.isSuccess(status));
}
}