Class BaseBinaryCommand
- java.lang.Object
-
- net.rubyeye.xmemcached.command.Command
-
- net.rubyeye.xmemcached.command.binary.BaseBinaryCommand
-
- All Implemented Interfaces:
WriteMessage
,StoreCommand
- Direct Known Subclasses:
BinaryAppendPrependCommand
,BinaryAuthListMechanismsCommand
,BinaryAuthStartCommand
,BinaryAuthStepCommand
,BinaryAWSElasticCacheConfigCommand
,BinaryCASCommand
,BinaryDeleteCommand
,BinaryFlushAllCommand
,BinaryGetCommand
,BinaryGetMultiCommand
,BinaryIncrDecrCommand
,BinaryNoopCommand
,BinaryQuitCommand
,BinarySetMultiCommand
,BinaryStatsCommand
,BinaryStoreCommand
,BinaryTouchCommand
,BinaryVerbosityCommand
,BinaryVersionCommand
public abstract class BaseBinaryCommand extends Command implements StoreCommand
Base Binary command.
-
-
Field Summary
Fields Modifier and Type Field Description protected long
cas
protected BinaryDecodeStatus
decodeStatus
(package private) static short
DEFAULT_VBUCKET_ID
protected int
expTime
(package private) static byte
EXTRAS_LENGTH
Set,add,replace protocol's extras lengthprotected int
opaque
protected OpCode
opCode
protected int
responseExtrasLength
protected int
responseKeyLength
protected ResponseStatus
responseStatus
protected int
responseTotalBodyLength
protected java.lang.Object
value
protected short
vbucketId
-
Fields inherited from class net.rubyeye.xmemcached.command.Command
cancel, commandType, exception, ioBuffer, key, keyBytes, latch, mergeCount, noreply, REQUEST_MAGIC_NUMBER, RESPONSE_MAGIC_NUMBER, result, status, transcoder, writeFuture
-
-
Constructor Summary
Constructors Constructor Description BaseBinaryCommand(java.lang.String key, byte[] keyBytes, CommandType cmdType, java.util.concurrent.CountDownLatch latch, int exp, long cas, java.lang.Object value, boolean noreply, Transcoder transcoder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
decode(MemcachedTCPSession session, java.nio.ByteBuffer buffer)
void
encode()
protected void
fillExtras(CachedData data)
private void
fillHeader(CachedData data)
protected void
fillKey()
protected void
fillValue(CachedData data)
protected boolean
finish()
long
getCas()
protected long
getCasValue()
int
getExpTime()
protected byte
getExtrasLength()
protected short
getKeyLength()
int
getOpaque()
OpCode
getOpCode()
ResponseStatus
getResponseStatus()
Transcoder
getTranscoder()
java.lang.Object
getValue()
protected int
getValueLength(CachedData data)
private void
markBuffer(java.nio.ByteBuffer buffer)
private int
readBodyLength(java.nio.ByteBuffer buffer)
protected long
readCAS(java.nio.ByteBuffer buffer)
private byte
readDataType(java.nio.ByteBuffer buffer)
protected boolean
readExtras(java.nio.ByteBuffer buffer, int extrasLength)
private int
readExtrasLength(java.nio.ByteBuffer buffer)
protected void
readHeader(java.nio.ByteBuffer buffer)
protected boolean
readKey(java.nio.ByteBuffer buffer, int keyLength)
private int
readKeyLength(java.nio.ByteBuffer buffer)
private void
readMagicNumber(java.nio.ByteBuffer buffer)
protected boolean
readOpaque(java.nio.ByteBuffer buffer)
protected boolean
readOpCode(java.nio.ByteBuffer buffer)
protected void
readStatus(java.nio.ByteBuffer buffer)
protected boolean
readValue(java.nio.ByteBuffer buffer, int bodyLength, int keyLength, int extrasLength)
void
setCas(long cas)
void
setExpTime(int exp)
void
setOpaque(int opaque)
void
setOpCode(OpCode opCode)
void
setResponseStatus(ResponseStatus responseStatus)
void
setTranscoder(Transcoder transcoder)
void
setValue(java.lang.Object value)
-
Methods inherited from class net.rubyeye.xmemcached.command.Command
cancel, countDownLatch, decodeError, decodeError, decodeError, decodeError, getCommandType, getCopiedMergeCount, getException, getIoBuffer, getKey, getKeyBytes, getLatch, getMergeCount, getMessage, getResult, getStatus, getWriteBuffer, getWriteFuture, isAdded, isCancel, isNoreply, isWriting, setAdded, setCommandType, setException, setIoBuffer, setKey, setKeyBytes, setLatch, setMergeCount, setNoreply, setResult, setStatus, setWriteBuffer, setWriteFuture, toString, writing
-
-
-
-
Field Detail
-
DEFAULT_VBUCKET_ID
static final short DEFAULT_VBUCKET_ID
- See Also:
- Constant Field Values
-
expTime
protected int expTime
-
cas
protected long cas
-
value
protected java.lang.Object value
-
opCode
protected OpCode opCode
-
decodeStatus
protected BinaryDecodeStatus decodeStatus
-
responseKeyLength
protected int responseKeyLength
-
responseExtrasLength
protected int responseExtrasLength
-
responseTotalBodyLength
protected int responseTotalBodyLength
-
responseStatus
protected ResponseStatus responseStatus
-
opaque
protected int opaque
-
vbucketId
protected short vbucketId
-
EXTRAS_LENGTH
static final byte EXTRAS_LENGTH
Set,add,replace protocol's extras length- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BaseBinaryCommand
public BaseBinaryCommand(java.lang.String key, byte[] keyBytes, CommandType cmdType, java.util.concurrent.CountDownLatch latch, int exp, long cas, java.lang.Object value, boolean noreply, Transcoder transcoder)
-
-
Method Detail
-
getExpTime
public final int getExpTime()
-
setExpTime
public final void setExpTime(int exp)
-
getCas
public final long getCas()
-
getOpaque
public int getOpaque()
-
setOpaque
public void setOpaque(int opaque)
-
setCas
public final void setCas(long cas)
-
getValue
public final java.lang.Object getValue()
- Specified by:
getValue
in interfaceStoreCommand
-
setValue
public final void setValue(java.lang.Object value)
- Specified by:
setValue
in interfaceStoreCommand
-
getTranscoder
public final Transcoder getTranscoder()
- Overrides:
getTranscoder
in classCommand
-
setTranscoder
public final void setTranscoder(Transcoder transcoder)
- Overrides:
setTranscoder
in classCommand
-
decode
public boolean decode(MemcachedTCPSession session, java.nio.ByteBuffer buffer)
-
finish
protected boolean finish()
-
readHeader
protected void readHeader(java.nio.ByteBuffer buffer)
-
markBuffer
private void markBuffer(java.nio.ByteBuffer buffer)
-
readOpaque
protected boolean readOpaque(java.nio.ByteBuffer buffer)
-
readCAS
protected long readCAS(java.nio.ByteBuffer buffer)
-
readKey
protected boolean readKey(java.nio.ByteBuffer buffer, int keyLength)
-
readValue
protected boolean readValue(java.nio.ByteBuffer buffer, int bodyLength, int keyLength, int extrasLength)
-
readExtras
protected boolean readExtras(java.nio.ByteBuffer buffer, int extrasLength)
-
readBodyLength
private int readBodyLength(java.nio.ByteBuffer buffer)
-
readStatus
protected void readStatus(java.nio.ByteBuffer buffer)
-
getOpCode
public final OpCode getOpCode()
-
setOpCode
public final void setOpCode(OpCode opCode)
-
getResponseStatus
public final ResponseStatus getResponseStatus()
-
setResponseStatus
public final void setResponseStatus(ResponseStatus responseStatus)
-
readKeyLength
private int readKeyLength(java.nio.ByteBuffer buffer)
-
readExtrasLength
private int readExtrasLength(java.nio.ByteBuffer buffer)
-
readDataType
private byte readDataType(java.nio.ByteBuffer buffer)
-
readOpCode
protected boolean readOpCode(java.nio.ByteBuffer buffer)
-
readMagicNumber
private void readMagicNumber(java.nio.ByteBuffer buffer)
-
fillValue
protected void fillValue(CachedData data)
-
fillKey
protected void fillKey()
-
fillExtras
protected void fillExtras(CachedData data)
-
fillHeader
private void fillHeader(CachedData data)
-
getCasValue
protected long getCasValue()
-
getValueLength
protected int getValueLength(CachedData data)
-
getKeyLength
protected short getKeyLength()
-
getExtrasLength
protected byte getExtrasLength()
-
-