public class KeyValueHandler extends AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,BinaryRequest>
The KeyValueHandler
is responsible for encoding BinaryRequest
s into lower level BinaryMemcacheRequest
s as well as decoding FullBinaryMemcacheResponse
s into CouchbaseResponse
s.
Modifier and Type | Class and Description |
---|---|
protected static class |
KeyValueHandler.KeepAliveRequest |
protected static class |
KeyValueHandler.KeepAliveResponse |
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
static byte |
OP_APPEND |
static byte |
OP_COUNTER_DECR |
static byte |
OP_COUNTER_INCR |
static byte |
OP_GET |
static byte |
OP_GET_ALL_MUTATION_TOKENS |
static byte |
OP_GET_AND_LOCK |
static byte |
OP_GET_AND_TOUCH |
static byte |
OP_GET_BUCKET_CONFIG |
static byte |
OP_GET_REPLICA |
static byte |
OP_INSERT |
static byte |
OP_NOOP |
static byte |
OP_OBSERVE |
static byte |
OP_OBSERVE_SEQ |
static byte |
OP_PREPEND |
static byte |
OP_REMOVE |
static byte |
OP_REPLACE |
static byte |
OP_STAT |
static byte |
OP_SUB_ARRAY_ADD_UNIQUE |
static byte |
OP_SUB_ARRAY_INSERT |
static byte |
OP_SUB_ARRAY_PUSH_FIRST |
static byte |
OP_SUB_ARRAY_PUSH_LAST |
static byte |
OP_SUB_COUNTER |
static byte |
OP_SUB_DELETE |
static byte |
OP_SUB_DICT_ADD |
static byte |
OP_SUB_DICT_UPSERT |
static byte |
OP_SUB_EXIST |
static byte |
OP_SUB_GET |
static byte |
OP_SUB_GET_COUNT |
static byte |
OP_SUB_MULTI_LOOKUP |
static byte |
OP_SUB_MULTI_MUTATION |
static byte |
OP_SUB_REPLACE |
static byte |
OP_TOUCH |
static byte |
OP_UNLOCK |
static byte |
OP_UPSERT |
static byte |
SUBDOC_BITMASK_MKDIR_P
The bitmask for sub-document extras “command” section (third byte of the extras) that activates the creation of missing intermediate nodes in the JSON path.
|
static byte |
SUBDOC_DOCFLAG_ACCESS_DELETED
The bitmask for sub-document access deleted
|
static byte |
SUBDOC_DOCFLAG_INSERT
The bitmask for sub-document insert document
|
static byte |
SUBDOC_DOCFLAG_MKDOC
The bitmask for sub-document create document
|
static byte |
SUBDOC_FLAG_XATTR_PATH
The bitmask for sub-document xattr/hidden section of the document
|
CHARSET, EMPTY_BYTES
Constructor and Description |
---|
KeyValueHandler(AbstractEndpoint endpoint,
com.lmax.disruptor.EventSink<ResponseEvent> responseBuffer,
boolean isTransient,
boolean pipeline)
Creates a new
KeyValueHandler with the default queue for requests. |
Modifier and Type | Method and Description |
---|---|
protected CouchbaseRequest |
createKeepAliveRequest()
Override to return a non-null request to be fired in the pipeline in case a keep alive is triggered.
|
protected CouchbaseResponse |
decodeResponse(ChannelHandlerContext ctx,
FullBinaryMemcacheResponse msg)
Decodes the incoming response and transforms it into a
CouchbaseResponse . |
protected BinaryMemcacheRequest |
encodeRequest(ChannelHandlerContext ctx,
BinaryRequest msg)
Encode the outgoing request and return it in encoded format.
|
protected ServiceType |
serviceType()
Returns the
ServiceType associated with this handler. |
protected void |
sideEffectRequestToCancel(BinaryRequest request)
Releasing the content of requests that are to be cancelled.
|
void |
userEventTriggered(ChannelHandlerContext ctx,
Object evt) |
addHttpBasicAuth, channelActive, channelInactive, channelWritabilityChanged, connect, currentRequest, decode, encode, endpoint, env, exceptionCaught, finishedDecoding, getDecodingState, handlerRemoved, logIdent, onKeepAliveFired, onKeepAliveResponse, publishResponse, remoteHostname, remoteHttpHost, write
acceptInboundMessage, acceptOutboundMessage, channelRead
bind, close, deregister, disconnect, flush, read
channelReadComplete, channelRegistered, channelUnregistered
ensureNotSharable, handlerAdded, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded
public static final byte OP_GET_BUCKET_CONFIG
public static final byte OP_GET
public static final byte OP_GET_AND_LOCK
public static final byte OP_GET_AND_TOUCH
public static final byte OP_GET_REPLICA
public static final byte OP_INSERT
public static final byte OP_UPSERT
public static final byte OP_REPLACE
public static final byte OP_REMOVE
public static final byte OP_COUNTER_INCR
public static final byte OP_COUNTER_DECR
public static final byte OP_UNLOCK
public static final byte OP_OBSERVE
public static final byte OP_OBSERVE_SEQ
public static final byte OP_TOUCH
public static final byte OP_APPEND
public static final byte OP_PREPEND
public static final byte OP_NOOP
public static final byte OP_STAT
public static final byte OP_GET_ALL_MUTATION_TOKENS
public static final byte OP_SUB_GET
public static final byte OP_SUB_EXIST
public static final byte OP_SUB_DICT_ADD
public static final byte OP_SUB_DICT_UPSERT
public static final byte OP_SUB_DELETE
public static final byte OP_SUB_REPLACE
public static final byte OP_SUB_ARRAY_PUSH_LAST
public static final byte OP_SUB_ARRAY_PUSH_FIRST
public static final byte OP_SUB_ARRAY_INSERT
public static final byte OP_SUB_ARRAY_ADD_UNIQUE
public static final byte OP_SUB_COUNTER
public static final byte OP_SUB_MULTI_LOOKUP
public static final byte OP_SUB_MULTI_MUTATION
public static final byte OP_SUB_GET_COUNT
public static final byte SUBDOC_BITMASK_MKDIR_P
The bitmask for sub-document extras “command” section (third byte of the extras) that activates the creation of missing intermediate nodes in the JSON path.
public static final byte SUBDOC_FLAG_XATTR_PATH
The bitmask for sub-document xattr/hidden section of the document
public static final byte SUBDOC_DOCFLAG_MKDOC
The bitmask for sub-document create document
public static final byte SUBDOC_DOCFLAG_INSERT
The bitmask for sub-document insert document
public static final byte SUBDOC_DOCFLAG_ACCESS_DELETED
The bitmask for sub-document access deleted
public KeyValueHandler(AbstractEndpoint endpoint, com.lmax.disruptor.EventSink<ResponseEvent> responseBuffer, boolean isTransient, boolean pipeline)
Creates a new KeyValueHandler
with the default queue for requests.
endpoint
- the AbstractEndpoint
to coordinate with.responseBuffer
- the RingBuffer
to push responses into.protected BinaryMemcacheRequest encodeRequest(ChannelHandlerContext ctx, BinaryRequest msg) throws Exception
AbstractGenericHandler
Encode the outgoing request and return it in encoded format.
This method needs to be implemented by the child handler and is responsible for the actual conversion.
encodeRequest
in class AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,BinaryRequest>
ctx
- the context passed in.msg
- the outgoing message.Exception
- as a generic error.protected CouchbaseResponse decodeResponse(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception
AbstractGenericHandler
Decodes the incoming response and transforms it into a CouchbaseResponse
.
Note that the actual notification is handled by this generic handler, the implementing class only is concerned about the conversion itself.
decodeResponse
in class AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,BinaryRequest>
ctx
- the context passed in.msg
- the incoming message.Exception
- as a generic error. It will be bubbled up to the user (wrapped in a CouchbaseException) in the onError of the request’s Observable.protected void sideEffectRequestToCancel(BinaryRequest request)
Releasing the content of requests that are to be cancelled.
sideEffectRequestToCancel
in class AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,BinaryRequest>
request
- the request to side effect on.public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
userEventTriggered
in interface ChannelInboundHandler
userEventTriggered
in class AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,BinaryRequest>
Exception
protected CouchbaseRequest createKeepAliveRequest()
AbstractGenericHandler
Override to return a non-null request to be fired in the pipeline in case a keep alive is triggered.
createKeepAliveRequest
in class AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,BinaryRequest>
protected ServiceType serviceType()
AbstractGenericHandler
Returns the ServiceType
associated with this handler.
serviceType
in class AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,BinaryRequest>
Copyright © 2017 Couchbase, Inc.. All rights reserved.