Adhere to our getter/setter naming rules
Motivation: Persuit for consistent method naming across all classes Modifications: Remove 'get' prefix for the getter methods in codec-memcache Result: More consistent method naming
This commit is contained in:
parent
2f650fdab7
commit
ca212c2162
@ -29,7 +29,7 @@ public abstract class AbstractMemcacheObject implements MemcacheObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DecoderResult getDecoderResult() {
|
public DecoderResult decoderResult() {
|
||||||
return decoderResult;
|
return decoderResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,5 +41,4 @@ public abstract class AbstractMemcacheObject implements MemcacheObject {
|
|||||||
|
|
||||||
decoderResult = result;
|
decoderResult = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,6 @@ public class DefaultMemcacheContent extends AbstractMemcacheObject implements Me
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return StringUtil.simpleClassName(this) +
|
return StringUtil.simpleClassName(this) +
|
||||||
"(data: " + content() + ", getDecoderResult: " + getDecoderResult() + ')';
|
"(data: " + content() + ", decoderResult: " + decoderResult() + ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public interface LastMemcacheContent extends MemcacheContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DecoderResult getDecoderResult() {
|
public DecoderResult decoderResult() {
|
||||||
return DecoderResult.SUCCESS;
|
return DecoderResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,23 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package io.netty.handler.codec.memcache;
|
package io.netty.handler.codec.memcache;
|
||||||
|
|
||||||
import io.netty.handler.codec.DecoderResult;
|
import io.netty.handler.codec.DecoderResultProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a common interface for all {@link MemcacheObject} implementations.
|
* Defines a common interface for all {@link MemcacheObject} implementations.
|
||||||
*/
|
*/
|
||||||
public interface MemcacheObject {
|
public interface MemcacheObject extends DecoderResultProvider { }
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the result of decoding this message.
|
|
||||||
*/
|
|
||||||
DecoderResult getDecoderResult();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the result of decoding this message.
|
|
||||||
* <p/>
|
|
||||||
* <p>Do not call this method unless you know what you are doing.</p>
|
|
||||||
*/
|
|
||||||
void setDecoderResult(DecoderResult result);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -24,7 +24,6 @@ import io.netty.handler.codec.memcache.DefaultLastMemcacheContent;
|
|||||||
import io.netty.handler.codec.memcache.DefaultMemcacheContent;
|
import io.netty.handler.codec.memcache.DefaultMemcacheContent;
|
||||||
import io.netty.handler.codec.memcache.LastMemcacheContent;
|
import io.netty.handler.codec.memcache.LastMemcacheContent;
|
||||||
import io.netty.handler.codec.memcache.MemcacheContent;
|
import io.netty.handler.codec.memcache.MemcacheContent;
|
||||||
import io.netty.handler.codec.memcache.MemcacheMessage;
|
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -84,7 +83,7 @@ public abstract class AbstractBinaryMemcacheDecoder<M extends BinaryMemcacheMess
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case READ_EXTRAS: try {
|
case READ_EXTRAS: try {
|
||||||
byte extrasLength = currentMessage.getExtrasLength();
|
byte extrasLength = currentMessage.extrasLength();
|
||||||
if (extrasLength > 0) {
|
if (extrasLength > 0) {
|
||||||
if (in.readableBytes() < extrasLength) {
|
if (in.readableBytes() < extrasLength) {
|
||||||
return;
|
return;
|
||||||
@ -99,7 +98,7 @@ public abstract class AbstractBinaryMemcacheDecoder<M extends BinaryMemcacheMess
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case READ_KEY: try {
|
case READ_KEY: try {
|
||||||
short keyLength = currentMessage.getKeyLength();
|
short keyLength = currentMessage.keyLength();
|
||||||
if (keyLength > 0) {
|
if (keyLength > 0) {
|
||||||
if (in.readableBytes() < keyLength) {
|
if (in.readableBytes() < keyLength) {
|
||||||
return;
|
return;
|
||||||
@ -116,9 +115,9 @@ public abstract class AbstractBinaryMemcacheDecoder<M extends BinaryMemcacheMess
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case READ_CONTENT: try {
|
case READ_CONTENT: try {
|
||||||
int valueLength = currentMessage.getTotalBodyLength()
|
int valueLength = currentMessage.totalBodyLength()
|
||||||
- currentMessage.getKeyLength()
|
- currentMessage.keyLength()
|
||||||
- currentMessage.getExtrasLength();
|
- currentMessage.extrasLength();
|
||||||
int toRead = in.readableBytes();
|
int toRead = in.readableBytes();
|
||||||
if (valueLength > 0) {
|
if (valueLength > 0) {
|
||||||
if (toRead == 0) {
|
if (toRead == 0) {
|
||||||
@ -201,8 +200,8 @@ public abstract class AbstractBinaryMemcacheDecoder<M extends BinaryMemcacheMess
|
|||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
super.channelInactive(ctx);
|
super.channelInactive(ctx);
|
||||||
|
|
||||||
if (currentMessage != null && currentMessage.getExtras() != null) {
|
if (currentMessage != null && currentMessage.extras() != null) {
|
||||||
currentMessage.getExtras().release();
|
currentMessage.extras().release();
|
||||||
}
|
}
|
||||||
|
|
||||||
resetDecoder();
|
resetDecoder();
|
||||||
|
@ -37,8 +37,8 @@ public abstract class AbstractBinaryMemcacheEncoder<M extends BinaryMemcacheMess
|
|||||||
ByteBuf buf = ctx.alloc().buffer(DEFAULT_BUFFER_SIZE);
|
ByteBuf buf = ctx.alloc().buffer(DEFAULT_BUFFER_SIZE);
|
||||||
|
|
||||||
encodeHeader(buf, msg);
|
encodeHeader(buf, msg);
|
||||||
encodeExtras(buf, msg.getExtras());
|
encodeExtras(buf, msg.extras());
|
||||||
encodeKey(buf, msg.getKey());
|
encodeKey(buf, msg.key());
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -56,12 +56,12 @@ public abstract class AbstractBinaryMemcacheMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getKey() {
|
public String key() {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ByteBuf getExtras() {
|
public ByteBuf extras() {
|
||||||
return extras;
|
return extras;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ public abstract class AbstractBinaryMemcacheMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte getMagic() {
|
public byte magic() {
|
||||||
return magic;
|
return magic;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,18 +89,18 @@ public abstract class AbstractBinaryMemcacheMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getCAS() {
|
public long cas() {
|
||||||
return cas;
|
return cas;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BinaryMemcacheMessage setCAS(long cas) {
|
public BinaryMemcacheMessage setCas(long cas) {
|
||||||
this.cas = cas;
|
this.cas = cas;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getOpaque() {
|
public int opaque() {
|
||||||
return opaque;
|
return opaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ public abstract class AbstractBinaryMemcacheMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTotalBodyLength() {
|
public int totalBodyLength() {
|
||||||
return totalBodyLength;
|
return totalBodyLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ public abstract class AbstractBinaryMemcacheMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte getDataType() {
|
public byte dataType() {
|
||||||
return dataType;
|
return dataType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ public abstract class AbstractBinaryMemcacheMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte getExtrasLength() {
|
public byte extrasLength() {
|
||||||
return extrasLength;
|
return extrasLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ public abstract class AbstractBinaryMemcacheMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short getKeyLength() {
|
public short keyLength() {
|
||||||
return keyLength;
|
return keyLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ public abstract class AbstractBinaryMemcacheMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte getOpcode() {
|
public byte opcode() {
|
||||||
return opcode;
|
return opcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public interface BinaryMemcacheMessage extends MemcacheMessage {
|
|||||||
*
|
*
|
||||||
* @return the magic byte.
|
* @return the magic byte.
|
||||||
*/
|
*/
|
||||||
byte getMagic();
|
byte magic();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the magic byte.
|
* Sets the magic byte.
|
||||||
@ -50,7 +50,7 @@ public interface BinaryMemcacheMessage extends MemcacheMessage {
|
|||||||
*
|
*
|
||||||
* @return the opcode.
|
* @return the opcode.
|
||||||
*/
|
*/
|
||||||
byte getOpcode();
|
byte opcode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the opcode for the message.
|
* Sets the opcode for the message.
|
||||||
@ -66,7 +66,7 @@ public interface BinaryMemcacheMessage extends MemcacheMessage {
|
|||||||
*
|
*
|
||||||
* @return the key length.
|
* @return the key length.
|
||||||
*/
|
*/
|
||||||
short getKeyLength();
|
short keyLength();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the key length of the message.
|
* Set the key length of the message.
|
||||||
@ -84,7 +84,7 @@ public interface BinaryMemcacheMessage extends MemcacheMessage {
|
|||||||
*
|
*
|
||||||
* @return the extras length.
|
* @return the extras length.
|
||||||
*/
|
*/
|
||||||
byte getExtrasLength();
|
byte extrasLength();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the extras length of the message.
|
* Set the extras length of the message.
|
||||||
@ -100,7 +100,7 @@ public interface BinaryMemcacheMessage extends MemcacheMessage {
|
|||||||
*
|
*
|
||||||
* @return the data type of the message.
|
* @return the data type of the message.
|
||||||
*/
|
*/
|
||||||
byte getDataType();
|
byte dataType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the data type of the message.
|
* Sets the data type of the message.
|
||||||
@ -116,7 +116,7 @@ public interface BinaryMemcacheMessage extends MemcacheMessage {
|
|||||||
*
|
*
|
||||||
* @return the total body length.
|
* @return the total body length.
|
||||||
*/
|
*/
|
||||||
int getTotalBodyLength();
|
int totalBodyLength();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the total body length.
|
* Sets the total body length.
|
||||||
@ -132,7 +132,7 @@ public interface BinaryMemcacheMessage extends MemcacheMessage {
|
|||||||
*
|
*
|
||||||
* @return the opaque value.
|
* @return the opaque value.
|
||||||
*/
|
*/
|
||||||
int getOpaque();
|
int opaque();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the opaque value.
|
* Sets the opaque value.
|
||||||
@ -146,21 +146,21 @@ public interface BinaryMemcacheMessage extends MemcacheMessage {
|
|||||||
*
|
*
|
||||||
* @return the CAS identifier.
|
* @return the CAS identifier.
|
||||||
*/
|
*/
|
||||||
long getCAS();
|
long cas();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the CAS identifier.
|
* Sets the CAS identifier.
|
||||||
*
|
*
|
||||||
* @param cas the CAS identifier to use.
|
* @param cas the CAS identifier to use.
|
||||||
*/
|
*/
|
||||||
BinaryMemcacheMessage setCAS(long cas);
|
BinaryMemcacheMessage setCas(long cas);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the optional key of the document.
|
* Returns the optional key of the document.
|
||||||
*
|
*
|
||||||
* @return the key of the document.
|
* @return the key of the document.
|
||||||
*/
|
*/
|
||||||
String getKey();
|
String key();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the key of the document.
|
* Sets the key of the document.
|
||||||
@ -174,7 +174,7 @@ public interface BinaryMemcacheMessage extends MemcacheMessage {
|
|||||||
*
|
*
|
||||||
* @return the optional extras.
|
* @return the optional extras.
|
||||||
*/
|
*/
|
||||||
ByteBuf getExtras();
|
ByteBuf extras();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the extras buffer on the message.
|
* Sets the extras buffer on the message.
|
||||||
|
@ -54,34 +54,34 @@ public class BinaryMemcacheObjectAggregator extends AbstractMemcacheObjectAggreg
|
|||||||
|
|
||||||
private static FullBinaryMemcacheRequest toFullRequest(BinaryMemcacheRequest request, ByteBuf content) {
|
private static FullBinaryMemcacheRequest toFullRequest(BinaryMemcacheRequest request, ByteBuf content) {
|
||||||
FullBinaryMemcacheRequest fullRequest =
|
FullBinaryMemcacheRequest fullRequest =
|
||||||
new DefaultFullBinaryMemcacheRequest(request.getKey(), request.getExtras(), content);
|
new DefaultFullBinaryMemcacheRequest(request.key(), request.extras(), content);
|
||||||
|
|
||||||
fullRequest.setMagic(request.getMagic());
|
fullRequest.setMagic(request.magic());
|
||||||
fullRequest.setOpcode(request.getOpcode());
|
fullRequest.setOpcode(request.opcode());
|
||||||
fullRequest.setKeyLength(request.getKeyLength());
|
fullRequest.setKeyLength(request.keyLength());
|
||||||
fullRequest.setExtrasLength(request.getExtrasLength());
|
fullRequest.setExtrasLength(request.extrasLength());
|
||||||
fullRequest.setDataType(request.getDataType());
|
fullRequest.setDataType(request.dataType());
|
||||||
fullRequest.setTotalBodyLength(request.getTotalBodyLength());
|
fullRequest.setTotalBodyLength(request.totalBodyLength());
|
||||||
fullRequest.setOpaque(request.getOpaque());
|
fullRequest.setOpaque(request.opaque());
|
||||||
fullRequest.setCAS(request.getCAS());
|
fullRequest.setCas(request.cas());
|
||||||
fullRequest.setReserved(request.getReserved());
|
fullRequest.setReserved(request.reserved());
|
||||||
|
|
||||||
return fullRequest;
|
return fullRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FullBinaryMemcacheResponse toFullResponse(BinaryMemcacheResponse response, ByteBuf content) {
|
private static FullBinaryMemcacheResponse toFullResponse(BinaryMemcacheResponse response, ByteBuf content) {
|
||||||
FullBinaryMemcacheResponse fullResponse =
|
FullBinaryMemcacheResponse fullResponse =
|
||||||
new DefaultFullBinaryMemcacheResponse(response.getKey(), response.getExtras(), content);
|
new DefaultFullBinaryMemcacheResponse(response.key(), response.extras(), content);
|
||||||
|
|
||||||
fullResponse.setMagic(response.getMagic());
|
fullResponse.setMagic(response.magic());
|
||||||
fullResponse.setOpcode(response.getOpcode());
|
fullResponse.setOpcode(response.opcode());
|
||||||
fullResponse.setKeyLength(response.getKeyLength());
|
fullResponse.setKeyLength(response.keyLength());
|
||||||
fullResponse.setExtrasLength(response.getExtrasLength());
|
fullResponse.setExtrasLength(response.extrasLength());
|
||||||
fullResponse.setDataType(response.getDataType());
|
fullResponse.setDataType(response.dataType());
|
||||||
fullResponse.setTotalBodyLength(response.getTotalBodyLength());
|
fullResponse.setTotalBodyLength(response.totalBodyLength());
|
||||||
fullResponse.setOpaque(response.getOpaque());
|
fullResponse.setOpaque(response.opaque());
|
||||||
fullResponse.setCAS(response.getCAS());
|
fullResponse.setCas(response.cas());
|
||||||
fullResponse.setStatus(response.getStatus());
|
fullResponse.setStatus(response.status());
|
||||||
|
|
||||||
return fullResponse;
|
return fullResponse;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public interface BinaryMemcacheRequest extends BinaryMemcacheMessage {
|
|||||||
*
|
*
|
||||||
* @return the reserved field value.
|
* @return the reserved field value.
|
||||||
*/
|
*/
|
||||||
short getReserved();
|
short reserved();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the reserved field value.
|
* Sets the reserved field value.
|
||||||
|
@ -43,7 +43,7 @@ public class BinaryMemcacheRequestDecoder
|
|||||||
header.setReserved(in.readShort());
|
header.setReserved(in.readShort());
|
||||||
header.setTotalBodyLength(in.readInt());
|
header.setTotalBodyLength(in.readInt());
|
||||||
header.setOpaque(in.readInt());
|
header.setOpaque(in.readInt());
|
||||||
header.setCAS(in.readLong());
|
header.setCas(in.readLong());
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,15 +25,15 @@ public class BinaryMemcacheRequestEncoder
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void encodeHeader(ByteBuf buf, BinaryMemcacheRequest msg) {
|
protected void encodeHeader(ByteBuf buf, BinaryMemcacheRequest msg) {
|
||||||
buf.writeByte(msg.getMagic());
|
buf.writeByte(msg.magic());
|
||||||
buf.writeByte(msg.getOpcode());
|
buf.writeByte(msg.opcode());
|
||||||
buf.writeShort(msg.getKeyLength());
|
buf.writeShort(msg.keyLength());
|
||||||
buf.writeByte(msg.getExtrasLength());
|
buf.writeByte(msg.extrasLength());
|
||||||
buf.writeByte(msg.getDataType());
|
buf.writeByte(msg.dataType());
|
||||||
buf.writeShort(msg.getReserved());
|
buf.writeShort(msg.reserved());
|
||||||
buf.writeInt(msg.getTotalBodyLength());
|
buf.writeInt(msg.totalBodyLength());
|
||||||
buf.writeInt(msg.getOpaque());
|
buf.writeInt(msg.opaque());
|
||||||
buf.writeLong(msg.getCAS());
|
buf.writeLong(msg.cas());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public interface BinaryMemcacheResponse extends BinaryMemcacheMessage {
|
|||||||
*
|
*
|
||||||
* @return the status of the response.
|
* @return the status of the response.
|
||||||
*/
|
*/
|
||||||
short getStatus();
|
short status();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the status of the response.
|
* Sets the status of the response.
|
||||||
|
@ -43,7 +43,7 @@ public class BinaryMemcacheResponseDecoder
|
|||||||
header.setStatus(in.readShort());
|
header.setStatus(in.readShort());
|
||||||
header.setTotalBodyLength(in.readInt());
|
header.setTotalBodyLength(in.readInt());
|
||||||
header.setOpaque(in.readInt());
|
header.setOpaque(in.readInt());
|
||||||
header.setCAS(in.readLong());
|
header.setCas(in.readLong());
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,15 +25,15 @@ public class BinaryMemcacheResponseEncoder
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void encodeHeader(ByteBuf buf, BinaryMemcacheResponse msg) {
|
protected void encodeHeader(ByteBuf buf, BinaryMemcacheResponse msg) {
|
||||||
buf.writeByte(msg.getMagic());
|
buf.writeByte(msg.magic());
|
||||||
buf.writeByte(msg.getOpcode());
|
buf.writeByte(msg.opcode());
|
||||||
buf.writeShort(msg.getKeyLength());
|
buf.writeShort(msg.keyLength());
|
||||||
buf.writeByte(msg.getExtrasLength());
|
buf.writeByte(msg.extrasLength());
|
||||||
buf.writeByte(msg.getDataType());
|
buf.writeByte(msg.dataType());
|
||||||
buf.writeShort(msg.getStatus());
|
buf.writeShort(msg.status());
|
||||||
buf.writeInt(msg.getTotalBodyLength());
|
buf.writeInt(msg.totalBodyLength());
|
||||||
buf.writeInt(msg.getOpaque());
|
buf.writeInt(msg.opaque());
|
||||||
buf.writeLong(msg.getCAS());
|
buf.writeLong(msg.cas());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class DefaultBinaryMemcacheRequest extends AbstractBinaryMemcacheMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short getReserved() {
|
public short reserved() {
|
||||||
return reserved;
|
return reserved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public class DefaultBinaryMemcacheResponse extends AbstractBinaryMemcacheMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short getStatus() {
|
public short status() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,19 +105,19 @@ public class DefaultFullBinaryMemcacheRequest extends DefaultBinaryMemcacheReque
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FullBinaryMemcacheRequest copy() {
|
public FullBinaryMemcacheRequest copy() {
|
||||||
ByteBuf extras = getExtras();
|
ByteBuf extras = extras();
|
||||||
if (extras != null) {
|
if (extras != null) {
|
||||||
extras = extras.copy();
|
extras = extras.copy();
|
||||||
}
|
}
|
||||||
return new DefaultFullBinaryMemcacheRequest(getKey(), extras, content().copy());
|
return new DefaultFullBinaryMemcacheRequest(key(), extras, content().copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FullBinaryMemcacheRequest duplicate() {
|
public FullBinaryMemcacheRequest duplicate() {
|
||||||
ByteBuf extras = getExtras();
|
ByteBuf extras = extras();
|
||||||
if (extras != null) {
|
if (extras != null) {
|
||||||
extras = extras.duplicate();
|
extras = extras.duplicate();
|
||||||
}
|
}
|
||||||
return new DefaultFullBinaryMemcacheRequest(getKey(), extras, content().duplicate());
|
return new DefaultFullBinaryMemcacheRequest(key(), extras, content().duplicate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,19 +105,19 @@ public class DefaultFullBinaryMemcacheResponse extends DefaultBinaryMemcacheResp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FullBinaryMemcacheResponse copy() {
|
public FullBinaryMemcacheResponse copy() {
|
||||||
ByteBuf extras = getExtras();
|
ByteBuf extras = extras();
|
||||||
if (extras != null) {
|
if (extras != null) {
|
||||||
extras = extras.copy();
|
extras = extras.copy();
|
||||||
}
|
}
|
||||||
return new DefaultFullBinaryMemcacheResponse(getKey(), extras, content().copy());
|
return new DefaultFullBinaryMemcacheResponse(key(), extras, content().copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FullBinaryMemcacheResponse duplicate() {
|
public FullBinaryMemcacheResponse duplicate() {
|
||||||
ByteBuf extras = getExtras();
|
ByteBuf extras = extras();
|
||||||
if (extras != null) {
|
if (extras != null) {
|
||||||
extras = extras.duplicate();
|
extras = extras.duplicate();
|
||||||
}
|
}
|
||||||
return new DefaultFullBinaryMemcacheResponse(getKey(), extras, content().duplicate());
|
return new DefaultFullBinaryMemcacheResponse(key(), extras, content().duplicate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,12 +90,12 @@ public class BinaryMemcacheDecoderTest {
|
|||||||
BinaryMemcacheRequest request = channel.readInbound();
|
BinaryMemcacheRequest request = channel.readInbound();
|
||||||
|
|
||||||
assertThat(request, notNullValue());
|
assertThat(request, notNullValue());
|
||||||
assertThat(request.getKey(), notNullValue());
|
assertThat(request.key(), notNullValue());
|
||||||
assertThat(request.getExtras(), nullValue());
|
assertThat(request.extras(), nullValue());
|
||||||
|
|
||||||
assertThat(request.getKeyLength(), is((short) 3));
|
assertThat(request.keyLength(), is((short) 3));
|
||||||
assertThat(request.getExtrasLength(), is((byte) 0));
|
assertThat(request.extrasLength(), is((byte) 0));
|
||||||
assertThat(request.getTotalBodyLength(), is(3));
|
assertThat(request.totalBodyLength(), is(3));
|
||||||
|
|
||||||
request.release();
|
request.release();
|
||||||
assertThat(channel.readInbound(), instanceOf(LastMemcacheContent.class));
|
assertThat(channel.readInbound(), instanceOf(LastMemcacheContent.class));
|
||||||
@ -116,12 +116,12 @@ public class BinaryMemcacheDecoderTest {
|
|||||||
BinaryMemcacheRequest request = channel.readInbound();
|
BinaryMemcacheRequest request = channel.readInbound();
|
||||||
|
|
||||||
assertThat(request, notNullValue());
|
assertThat(request, notNullValue());
|
||||||
assertThat(request.getKey(), notNullValue());
|
assertThat(request.key(), notNullValue());
|
||||||
assertThat(request.getExtras(), nullValue());
|
assertThat(request.extras(), nullValue());
|
||||||
|
|
||||||
assertThat(request.getKeyLength(), is((short) 3));
|
assertThat(request.keyLength(), is((short) 3));
|
||||||
assertThat(request.getExtrasLength(), is((byte) 0));
|
assertThat(request.extrasLength(), is((byte) 0));
|
||||||
assertThat(request.getTotalBodyLength(), is(11));
|
assertThat(request.totalBodyLength(), is(11));
|
||||||
|
|
||||||
request.release();
|
request.release();
|
||||||
|
|
||||||
@ -153,8 +153,8 @@ public class BinaryMemcacheDecoderTest {
|
|||||||
BinaryMemcacheRequest request = channel.readInbound();
|
BinaryMemcacheRequest request = channel.readInbound();
|
||||||
|
|
||||||
assertThat(request, notNullValue());
|
assertThat(request, notNullValue());
|
||||||
assertThat(request.getKey(), notNullValue());
|
assertThat(request.key(), notNullValue());
|
||||||
assertThat(request.getExtras(), nullValue());
|
assertThat(request.extras(), nullValue());
|
||||||
|
|
||||||
request.release();
|
request.release();
|
||||||
|
|
||||||
@ -208,8 +208,8 @@ public class BinaryMemcacheDecoderTest {
|
|||||||
|
|
||||||
// First message
|
// First message
|
||||||
BinaryMemcacheResponse response = channel.readInbound();
|
BinaryMemcacheResponse response = channel.readInbound();
|
||||||
assertThat(response.getStatus(), is(BinaryMemcacheResponseStatus.KEY_ENOENT));
|
assertThat(response.status(), is(BinaryMemcacheResponseStatus.KEY_ENOENT));
|
||||||
assertThat(response.getTotalBodyLength(), is(msgBody.length()));
|
assertThat(response.totalBodyLength(), is(msgBody.length()));
|
||||||
response.release();
|
response.release();
|
||||||
|
|
||||||
// First message first content chunk
|
// First message first content chunk
|
||||||
@ -220,8 +220,8 @@ public class BinaryMemcacheDecoderTest {
|
|||||||
|
|
||||||
// Second message
|
// Second message
|
||||||
response = channel.readInbound();
|
response = channel.readInbound();
|
||||||
assertThat(response.getStatus(), is(BinaryMemcacheResponseStatus.KEY_ENOENT));
|
assertThat(response.status(), is(BinaryMemcacheResponseStatus.KEY_ENOENT));
|
||||||
assertThat(response.getTotalBodyLength(), is(msgBody.length()));
|
assertThat(response.totalBodyLength(), is(msgBody.length()));
|
||||||
response.release();
|
response.release();
|
||||||
|
|
||||||
// Second message first content chunk
|
// Second message first content chunk
|
||||||
@ -238,8 +238,8 @@ public class BinaryMemcacheDecoderTest {
|
|||||||
|
|
||||||
// Third message
|
// Third message
|
||||||
response = channel.readInbound();
|
response = channel.readInbound();
|
||||||
assertThat(response.getStatus(), is(BinaryMemcacheResponseStatus.KEY_ENOENT));
|
assertThat(response.status(), is(BinaryMemcacheResponseStatus.KEY_ENOENT));
|
||||||
assertThat(response.getTotalBodyLength(), is(msgBody.length()));
|
assertThat(response.totalBodyLength(), is(msgBody.length()));
|
||||||
response.release();
|
response.release();
|
||||||
|
|
||||||
// Third message first content chunk
|
// Third message first content chunk
|
||||||
|
@ -61,8 +61,8 @@ public class BinaryMemcacheObjectAggregatorTest {
|
|||||||
|
|
||||||
assertThat(request, instanceOf(FullBinaryMemcacheRequest.class));
|
assertThat(request, instanceOf(FullBinaryMemcacheRequest.class));
|
||||||
assertThat(request, notNullValue());
|
assertThat(request, notNullValue());
|
||||||
assertThat(request.getKey(), notNullValue());
|
assertThat(request.key(), notNullValue());
|
||||||
assertThat(request.getExtras(), nullValue());
|
assertThat(request.extras(), nullValue());
|
||||||
|
|
||||||
assertThat(request.content().readableBytes(), is(8));
|
assertThat(request.content().readableBytes(), is(8));
|
||||||
assertThat(request.content().readByte(), is((byte) 0x01));
|
assertThat(request.content().readByte(), is((byte) 0x01));
|
||||||
|
Loading…
Reference in New Issue
Block a user