public abstract class OperationImpl extends BaseOperationImpl implements Operation
Modifier and Type | Field and Description |
---|---|
protected static byte |
DUMMY_OPCODE |
protected static byte[] |
EMPTY_BYTES |
protected static int |
ERR_2BIG |
protected static int |
ERR_BUSY |
protected static int |
ERR_DELTA_BADVAL |
protected static int |
ERR_EXISTS |
protected static int |
ERR_INTERNAL |
protected static int |
ERR_INVAL |
protected static int |
ERR_NO_MEM |
protected static int |
ERR_NOT_FOUND |
protected static int |
ERR_NOT_MY_VBUCKET |
protected static int |
ERR_NOT_STORED |
protected static int |
ERR_NOT_SUPPORTED |
protected static int |
ERR_TEMP_FAIL |
protected static int |
ERR_UNKNOWN_COMMAND |
protected int |
errorCode |
protected int |
keyLen |
protected static int |
MIN_RECV_PACKET |
protected int |
opaque |
protected static byte |
REQ_MAGIC |
protected static byte |
RES_MAGIC |
protected long |
responseCas |
protected byte |
responseCmd |
protected int |
responseOpaque |
protected static OperationStatus |
STATUS_OK |
protected static int |
SUCCESS
Error code for operations.
|
protected short |
vbucket |
callback, CANCELLED, notMyVbucketNodes, TIMED_OUT
Modifier | Constructor and Description |
---|---|
protected |
OperationImpl(byte c,
int o,
OperationCallback cb)
Construct with opaque.
|
Modifier and Type | Method and Description |
---|---|
protected void |
decodePayload(byte[] pl)
Decode the given payload for this command.
|
protected void |
finishedPayload(byte[] pl) |
byte[] |
getErrorMsg()
Returns the raw bytes of the error message content.
|
protected OperationStatus |
getStatusForErrorCode(int errCode,
byte[] errPl)
Get the OperationStatus object for the given error code.
|
protected boolean |
opaqueIsValid()
Validate an opaque value from the header.
|
protected void |
prepareBuffer(String key,
long cas,
byte[] val,
Object... extraHeaders)
Prepare the buffer for sending.
|
void |
readFromBuffer(ByteBuffer buffer)
Read from the incoming
ByteBuffer . |
protected void |
resetInput() |
String |
toString() |
addClone, cancel, getBuffer, getCallback, getCloneCount, getException, getHandlingNode, getState, getWriteCompleteTimestamp, handleError, handleRead, hasErrored, initialize, isCancelled, isTimedOut, isTimedOut, isTimedOutUnsent, setBuffer, setCallback, setCloneCount, setHandlingNode, timeOut, transitionState, wasCancelled, writeComplete, writing
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addClone, cancel, getBuffer, getCallback, getCloneCount, getException, getHandlingNode, getState, getWriteCompleteTimestamp, handleRead, hasErrored, initialize, isCancelled, isTimedOut, isTimedOut, isTimedOutUnsent, setCloneCount, setHandlingNode, timeOut, writeComplete, writing
protected static final byte REQ_MAGIC
protected static final byte RES_MAGIC
protected static final byte DUMMY_OPCODE
protected static final int MIN_RECV_PACKET
protected static final int SUCCESS
protected static final int ERR_NOT_FOUND
protected static final int ERR_EXISTS
protected static final int ERR_2BIG
protected static final int ERR_INVAL
protected static final int ERR_NOT_STORED
protected static final int ERR_DELTA_BADVAL
protected static final int ERR_NOT_MY_VBUCKET
protected static final int ERR_UNKNOWN_COMMAND
protected static final int ERR_NO_MEM
protected static final int ERR_NOT_SUPPORTED
protected static final int ERR_INTERNAL
protected static final int ERR_BUSY
protected static final int ERR_TEMP_FAIL
protected static final byte[] EMPTY_BYTES
protected static final OperationStatus STATUS_OK
protected short vbucket
protected final int opaque
protected int keyLen
protected byte responseCmd
protected int errorCode
protected int responseOpaque
protected long responseCas
protected OperationImpl(byte c, int o, OperationCallback cb)
o
- the opaque value.cb
- protected void resetInput()
public void readFromBuffer(ByteBuffer buffer) throws IOException
ByteBuffer
.
Reading from the buffer is done in stages, depending on how much data
can be read at once. First, the header is read and then parsed (24
bytes, indicated by MIN_RECV_PACKET
). Then, the payload is read
(if one is available for this operation and can be loaded fully).readFromBuffer
in interface Operation
readFromBuffer
in class BaseOperationImpl
buffer
- the buffer to read from.IOException
- if an error happened during parsing/reading.protected void finishedPayload(byte[] pl) throws IOException
IOException
protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl) throws IOException
errCode
- the error codeIOException
protected void decodePayload(byte[] pl)
pl
- the payload.protected boolean opaqueIsValid()
protected void prepareBuffer(String key, long cas, byte[] val, Object... extraHeaders)
key
- the key (for keyed ops).cas
- the cas value.val
- the data payload.extraHeaders
- any additional headers that need to be sent.public byte[] getErrorMsg()
Operation
getErrorMsg
in interface Operation
Copyright © 2018. All rights reserved.