2013-10-01 15:42:05 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2013 The Netty Project
|
|
|
|
*
|
|
|
|
* The Netty Project licenses this file to you under the Apache License,
|
|
|
|
* version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at:
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
package io.netty.handler.codec.memcache.binary;
|
|
|
|
|
|
|
|
import io.netty.buffer.ByteBuf;
|
2016-04-12 14:22:41 +02:00
|
|
|
import io.netty.util.internal.UnstableApi;
|
2013-10-01 15:42:05 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The default implementation of the {@link BinaryMemcacheRequest}.
|
|
|
|
*/
|
2016-04-12 14:22:41 +02:00
|
|
|
@UnstableApi
|
2014-02-28 08:08:40 +01:00
|
|
|
public class DefaultBinaryMemcacheRequest extends AbstractBinaryMemcacheMessage implements BinaryMemcacheRequest {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default magic byte for a request.
|
|
|
|
*/
|
|
|
|
public static final byte REQUEST_MAGIC_BYTE = (byte) 0x80;
|
|
|
|
|
|
|
|
private short reserved;
|
2013-10-01 15:42:05 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new {@link DefaultBinaryMemcacheRequest} with the header only.
|
|
|
|
*/
|
2014-02-28 08:08:40 +01:00
|
|
|
public DefaultBinaryMemcacheRequest() {
|
|
|
|
this(null, null);
|
2013-10-01 15:42:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new {@link DefaultBinaryMemcacheRequest} with the header and key.
|
|
|
|
*
|
|
|
|
* @param key the key to use.
|
|
|
|
*/
|
2016-01-29 18:58:35 +01:00
|
|
|
public DefaultBinaryMemcacheRequest(ByteBuf key) {
|
2014-02-28 08:08:40 +01:00
|
|
|
this(key, null);
|
2013-10-01 15:42:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new {@link DefaultBinaryMemcacheRequest} with the header only.
|
|
|
|
*
|
|
|
|
* @param key the key to use.
|
|
|
|
* @param extras the extras to use.
|
|
|
|
*/
|
2016-01-29 18:58:35 +01:00
|
|
|
public DefaultBinaryMemcacheRequest(ByteBuf key, ByteBuf extras) {
|
2014-02-28 08:08:40 +01:00
|
|
|
super(key, extras);
|
|
|
|
setMagic(REQUEST_MAGIC_BYTE);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-06-24 09:08:46 +02:00
|
|
|
public short reserved() {
|
2014-02-28 08:08:40 +01:00
|
|
|
return reserved;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public BinaryMemcacheRequest setReserved(short reserved) {
|
|
|
|
this.reserved = reserved;
|
|
|
|
return this;
|
2013-10-01 15:42:05 +02:00
|
|
|
}
|
|
|
|
|
2014-01-28 12:00:28 +01:00
|
|
|
@Override
|
|
|
|
public BinaryMemcacheRequest retain() {
|
|
|
|
super.retain();
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public BinaryMemcacheRequest retain(int increment) {
|
|
|
|
super.retain(increment);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public BinaryMemcacheRequest touch() {
|
|
|
|
super.touch();
|
|
|
|
return this;
|
|
|
|
}
|
2014-01-29 03:44:59 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public BinaryMemcacheRequest touch(Object hint) {
|
|
|
|
super.touch(hint);
|
|
|
|
return this;
|
|
|
|
}
|
2019-05-22 11:05:52 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Copies special metadata hold by this instance to the provided instance
|
|
|
|
*
|
|
|
|
* @param dst The instance where to copy the metadata of this instance to
|
|
|
|
*/
|
|
|
|
void copyMeta(DefaultBinaryMemcacheRequest dst) {
|
|
|
|
super.copyMeta(dst);
|
|
|
|
dst.reserved = reserved;
|
|
|
|
}
|
2013-10-01 15:42:05 +02:00
|
|
|
}
|