List of usage examples for io.netty.handler.codec.memcache.binary FullBinaryMemcacheRequest setReserved
BinaryMemcacheRequest setReserved(short reserved);
From source file:com.couchbase.client.core.endpoint.binary.BinaryCodec.java
License:Open Source License
/** * Creates the actual protocol level request for an incoming upsert request. * * @param request the incoming upsert request. * @param ctx the channel handler context for buffer allocations. * @return the built protocol request./*from www. ja v a2s .c o m*/ */ private BinaryMemcacheRequest handleUpsertRequest(final UpsertRequest request, final ChannelHandlerContext ctx) { ByteBuf extras = ctx.alloc().buffer(8); extras.writeInt(request.flags()); extras.writeInt(request.expiration()); FullBinaryMemcacheRequest msg = new DefaultFullBinaryMemcacheRequest(request.key(), extras, request.content()); msg.setOpcode(BinaryMemcacheOpcodes.SET); msg.setKeyLength((short) request.key().length()); msg.setTotalBodyLength( (short) request.key().length() + request.content().readableBytes() + extras.readableBytes()); msg.setReserved(request.partition()); msg.setExtrasLength((byte) extras.readableBytes()); return msg; }
From source file:com.couchbase.client.core.endpoint.binary.BinaryCodec.java
License:Open Source License
/** * Creates the actual protocol level request for an incoming replacer request. * * @param request the incoming replace request. * @param ctx the channel handler context for buffer allocations. * @return the built protocol request./* ww w . j a va2 s.c o m*/ */ private BinaryMemcacheRequest handleReplaceRequest(final ReplaceRequest request, final ChannelHandlerContext ctx) { ByteBuf extras = ctx.alloc().buffer(8); extras.writeInt(request.flags()); extras.writeInt(request.expiration()); FullBinaryMemcacheRequest msg = new DefaultFullBinaryMemcacheRequest(request.key(), extras, request.content()); msg.setOpcode(BinaryMemcacheOpcodes.REPLACE); msg.setCAS(request.cas()); msg.setKeyLength((short) request.key().length()); msg.setTotalBodyLength( (short) request.key().length() + request.content().readableBytes() + extras.readableBytes()); msg.setReserved(request.partition()); msg.setExtrasLength((byte) extras.readableBytes()); return msg; }
From source file:com.couchbase.client.core.endpoint.binary.BinaryCodec.java
License:Open Source License
/** * Creates the actual protocol level request for an incoming insert request. * * @param request the incoming insert request. * @param ctx the channel handler context for buffer allocations. * @return the built protocol request./*from w w w. jav a 2 s . c o m*/ */ private BinaryMemcacheRequest handleInsertRequest(final InsertRequest request, final ChannelHandlerContext ctx) { ByteBuf extras = ctx.alloc().buffer(8); extras.writeInt(request.flags()); extras.writeInt(request.expiration()); FullBinaryMemcacheRequest msg = new DefaultFullBinaryMemcacheRequest(request.key(), extras, request.content()); msg.setOpcode(BinaryMemcacheOpcodes.ADD); msg.setKeyLength((short) request.key().length()); msg.setTotalBodyLength( (short) request.key().length() + request.content().readableBytes() + extras.readableBytes()); msg.setReserved(request.partition()); msg.setExtrasLength((byte) extras.readableBytes()); return msg; }