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 | 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_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_OBSERVE |
static byte |
OP_PREPEND |
static byte |
OP_REMOVE |
static byte |
OP_REPLACE |
static byte |
OP_TOUCH |
static byte |
OP_UNLOCK |
static byte |
OP_UPSERT |
CHARSET
Constructor and Description |
---|
KeyValueHandler(AbstractEndpoint endpoint,
com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer)
Creates a new
KeyValueHandler with the default queue for requests. |
Modifier and Type | Method and Description |
---|---|
protected CouchbaseResponse |
decodeResponse(io.netty.channel.ChannelHandlerContext ctx,
FullBinaryMemcacheResponse msg)
Decodes the incoming response and transforms it into a
CouchbaseResponse . |
protected BinaryMemcacheRequest |
encodeRequest(io.netty.channel.ChannelHandlerContext ctx,
BinaryRequest msg)
Encode the outgoing request and return it in encoded format.
|
channelActive, channelInactive, channelWritabilityChanged, currentRequest, currentRequest, decode, encode, env, exceptionCaught, handlerRemoved, logIdent
acceptInboundMessage, acceptOutboundMessage, channelRead, write
bind, close, connect, deregister, disconnect, flush, read
channelReadComplete, channelRegistered, channelUnregistered, userEventTriggered
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_TOUCH
public static final byte OP_APPEND
public static final byte OP_PREPEND
public KeyValueHandler(AbstractEndpoint endpoint, com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer)
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(io.netty.channel.ChannelHandlerContext ctx, BinaryRequest msg) throws java.lang.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.java.lang.Exception
- as a generic error.protected CouchbaseResponse decodeResponse(io.netty.channel.ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws java.lang.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.java.lang.Exception
- as a generic error.