public class KeyValueHandler extends AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,BinaryRequest>
The KeyValueHandler is responsible for encoding BinaryRequests into lower level BinaryMemcacheRequests as well as decoding FullBinaryMemcacheResponses into CouchbaseResponses.
| 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_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.
|
CHARSET| Constructor and Description |
|---|
KeyValueHandler(AbstractEndpoint endpoint,
com.lmax.disruptor.EventSink<ResponseEvent> responseBuffer,
boolean isTransient)
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) |
channelActive, channelInactive, channelWritabilityChanged, connect, currentRequest, currentRequest, decode, encode, endpoint, env, exceptionCaught, finishedDecoding, handlerRemoved, logIdent, onKeepAliveFired, onKeepAliveResponse, publishResponse, remoteHostnameacceptInboundMessage, acceptOutboundMessage, channelRead, writebind, close, deregister, disconnect, flush, readchannelReadComplete, channelRegistered, channelUnregisteredhandlerAdded, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerAddedpublic 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 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 KeyValueHandler(AbstractEndpoint endpoint, com.lmax.disruptor.EventSink<ResponseEvent> responseBuffer, boolean isTransient)
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
AbstractGenericHandlerEncode 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
AbstractGenericHandlerDecodes 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 ChannelInboundHandleruserEventTriggered in class AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,BinaryRequest>Exceptionprotected CouchbaseRequest createKeepAliveRequest()
AbstractGenericHandlerOverride 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()
AbstractGenericHandlerReturns the ServiceType associated with this handler.
serviceType in class AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,BinaryRequest>Copyright © 2016 Couchbase, Inc.. All rights reserved.