Package com.couchbase.client.dcp.message
Enum MessageUtil
- All Implemented Interfaces:
Serializable
,Comparable<MessageUtil>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte
static final byte
static final int
static final int
static final byte
static final int
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final int
static final byte
static final byte
static final byte
static final int
static final byte
static final byte
static final int
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final int
static final byte
static final byte
static final byte
static final byte
static final byte
static final int
static final byte
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
getCas
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static CollectionIdAndKey
getCollectionIdAndKey
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer, boolean collectionsEnabled) static com.couchbase.client.core.deps.io.netty.buffer.ByteBuf
getContent
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Returns the message content, uncompressed.static ContentAndXattrs
getContentAndXattrs
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static byte[]
getContentAsByteArray
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Returns a new array containing the uncompressed content of the given message.static String
getContentAsString
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static byte
getDataType
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static com.couchbase.client.core.deps.io.netty.buffer.ByteBuf
getExtras
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static com.couchbase.client.core.deps.io.netty.buffer.ByteBuf
getKey
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static String
getKeyAsString
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static int
getOpaque
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static int
getOpcode
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buf) static com.couchbase.client.core.deps.io.netty.buffer.ByteBuf
getRawContent
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Returns the message content in its original form (possibly compressed).static ResponseStatus
getResponseStatus
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static String
getShortOpcodeName
(int opcode) static String
getShortOpcodeName
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buf) static short
getStatus
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Deprecated.static int
getVbucket
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static String
humanize
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Dumps the given ByteBuf in the "wire format".static void
initRequest
(byte opcode, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Helper method to initialize a request with an opcode.static void
initResponse
(byte opcode, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Helper method to initialize a response with an opcode.static boolean
isComplete
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Returns true if message can be processed and false if more data is needed.static boolean
isSnappyCompressed
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static boolean
requiresFlowControlAck
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf message) static void
setContent
(byte[] content, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static void
setContent
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf content, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Sets the content payload of the buffer, updating the content length as well.static void
setDataType
(byte dataType, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static void
setExtras
(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf extras, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static void
Helper method to set the key, update the key length and the content length.static void
setOpaque
(int opaque, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static void
setVbucket
(int vbucket, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) static MessageUtil
Returns the enum constant of this type with the specified name.static MessageUtil[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Field Details
-
HEADER_SIZE
public static final int HEADER_SIZE- See Also:
-
MAGIC_INT
public static final byte MAGIC_INT- See Also:
-
MAGIC_REQ
public static final byte MAGIC_REQ- See Also:
-
MAGIC_RES
public static final byte MAGIC_RES- See Also:
-
MAGIC_SERVER_REQ
public static final byte MAGIC_SERVER_REQ- See Also:
-
MAGIC_SERVER_RES
public static final byte MAGIC_SERVER_RES- See Also:
-
KEY_LENGTH_OFFSET
public static final int KEY_LENGTH_OFFSET- See Also:
-
EXTRAS_LENGTH_OFFSET
public static final int EXTRAS_LENGTH_OFFSET- See Also:
-
DATA_TYPE_OFFSET
public static final int DATA_TYPE_OFFSET- See Also:
-
VBUCKET_OFFSET
public static final int VBUCKET_OFFSET- See Also:
-
BODY_LENGTH_OFFSET
public static final int BODY_LENGTH_OFFSET- See Also:
-
OPAQUE_OFFSET
public static final int OPAQUE_OFFSET- See Also:
-
CAS_OFFSET
public static final int CAS_OFFSET- See Also:
-
NOOP_OPCODE
public static final byte NOOP_OPCODE- See Also:
-
VERSION_OPCODE
public static final byte VERSION_OPCODE- See Also:
-
HELLO_OPCODE
public static final byte HELLO_OPCODE- See Also:
-
SASL_LIST_MECHS_OPCODE
public static final byte SASL_LIST_MECHS_OPCODE- See Also:
-
SASL_AUTH_OPCODE
public static final byte SASL_AUTH_OPCODE- See Also:
-
SASL_STEP_OPCODE
public static final byte SASL_STEP_OPCODE- See Also:
-
GET_SEQNOS_OPCODE
public static final byte GET_SEQNOS_OPCODE- See Also:
-
OPEN_CONNECTION_OPCODE
public static final byte OPEN_CONNECTION_OPCODE- See Also:
-
DCP_ADD_STREAM_OPCODE
public static final byte DCP_ADD_STREAM_OPCODE- See Also:
-
DCP_STREAM_CLOSE_OPCODE
public static final byte DCP_STREAM_CLOSE_OPCODE- See Also:
-
DCP_STREAM_REQUEST_OPCODE
public static final byte DCP_STREAM_REQUEST_OPCODE- See Also:
-
DCP_FAILOVER_LOG_OPCODE
public static final byte DCP_FAILOVER_LOG_OPCODE- See Also:
-
DCP_STREAM_END_OPCODE
public static final byte DCP_STREAM_END_OPCODE- See Also:
-
DCP_SNAPSHOT_MARKER_OPCODE
public static final byte DCP_SNAPSHOT_MARKER_OPCODE- See Also:
-
DCP_MUTATION_OPCODE
public static final byte DCP_MUTATION_OPCODE- See Also:
-
DCP_DELETION_OPCODE
public static final byte DCP_DELETION_OPCODE- See Also:
-
DCP_EXPIRATION_OPCODE
public static final byte DCP_EXPIRATION_OPCODE- See Also:
-
DCP_FLUSH_OPCODE
public static final byte DCP_FLUSH_OPCODE- See Also:
-
DCP_SET_VBUCKET_STATE_OPCODE
public static final byte DCP_SET_VBUCKET_STATE_OPCODE- See Also:
-
DCP_NOOP_OPCODE
public static final byte DCP_NOOP_OPCODE- See Also:
-
DCP_BUFFER_ACK_OPCODE
public static final byte DCP_BUFFER_ACK_OPCODE- See Also:
-
DCP_CONTROL_OPCODE
public static final byte DCP_CONTROL_OPCODE- See Also:
-
DCP_SYSTEM_EVENT_OPCODE
public static final byte DCP_SYSTEM_EVENT_OPCODE- See Also:
-
DCP_SEQNO_ADVANCED_OPCODE
public static final byte DCP_SEQNO_ADVANCED_OPCODE- See Also:
-
DCP_OSO_SNAPSHOT_MARKER_OPCODE
public static final byte DCP_OSO_SNAPSHOT_MARKER_OPCODE- See Also:
-
SELECT_BUCKET_OPCODE
public static final byte SELECT_BUCKET_OPCODE- See Also:
-
OBSERVE_SEQNO_OPCODE
public static final byte OBSERVE_SEQNO_OPCODE- See Also:
-
GET_CLUSTER_CONFIG_OPCODE
public static final byte GET_CLUSTER_CONFIG_OPCODE- See Also:
-
GET_COLLECTIONS_MANIFEST_OPCODE
public static final byte GET_COLLECTIONS_MANIFEST_OPCODE- See Also:
-
INTERNAL_ROLLBACK_OPCODE
public static final byte INTERNAL_ROLLBACK_OPCODE- See Also:
-
CLUSTERMAP_CHANGE_NOTIFICATION_OPCODE
public static final byte CLUSTERMAP_CHANGE_NOTIFICATION_OPCODE- See Also:
-
AUTHENTICATE_OPCODE
public static final byte AUTHENTICATE_OPCODE- See Also:
-
ACTIVE_EXTERNAL_USERS_OPCODE
public static final byte ACTIVE_EXTERNAL_USERS_OPCODE- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getOpcode
public static int getOpcode(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buf) -
getShortOpcodeName
-
getShortOpcodeName
-
isComplete
public static boolean isComplete(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Returns true if message can be processed and false if more data is needed. -
humanize
Dumps the given ByteBuf in the "wire format".Note that the response is undefined if a buffer with a different content than the KV protocol is passed in.
- Returns:
- the String ready to be printed/logged.
-
initRequest
public static void initRequest(byte opcode, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Helper method to initialize a request with an opcode. -
initResponse
public static void initResponse(byte opcode, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Helper method to initialize a response with an opcode. -
setExtras
public static void setExtras(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf extras, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
getExtras
public static com.couchbase.client.core.deps.io.netty.buffer.ByteBuf getExtras(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
setVbucket
public static void setVbucket(int vbucket, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
getVbucket
public static int getVbucket(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
setKey
public static void setKey(String key, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Helper method to set the key, update the key length and the content length. -
getKey
public static com.couchbase.client.core.deps.io.netty.buffer.ByteBuf getKey(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
getKeyAsString
-
getCollectionIdAndKey
public static CollectionIdAndKey getCollectionIdAndKey(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer, boolean collectionsEnabled) -
setContent
public static void setContent(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf content, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Sets the content payload of the buffer, updating the content length as well. -
setContent
public static void setContent(byte[] content, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
getRawContent
public static com.couchbase.client.core.deps.io.netty.buffer.ByteBuf getRawContent(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Returns the message content in its original form (possibly compressed).The returned buffer shares its reference count with the given buffer.
-
getContent
public static com.couchbase.client.core.deps.io.netty.buffer.ByteBuf getContent(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Returns the message content, uncompressed.Callers need not release the returned buffer, since it either shares its reference count with the given buffer, or is unpooled and not leak-aware.
If XATTRs were requested, they will be included in the returned buffer.
-
getContentAndXattrs
public static ContentAndXattrs getContentAndXattrs(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
isSnappyCompressed
public static boolean isSnappyCompressed(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
getContentAsString
public static String getContentAsString(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
getContentAsByteArray
public static byte[] getContentAsByteArray(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Returns a new array containing the uncompressed content of the given message.If XATTRs were requested, they will be included in the returned byte array.
-
getStatus
@Deprecated public static short getStatus(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) Deprecated.in favor ofgetResponseStatus(ByteBuf)
-
getResponseStatus
public static ResponseStatus getResponseStatus(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
requiresFlowControlAck
public static boolean requiresFlowControlAck(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf message) -
getDataType
public static byte getDataType(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
setDataType
public static void setDataType(byte dataType, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
setOpaque
public static void setOpaque(int opaque, com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
getOpaque
public static int getOpaque(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer) -
getCas
public static long getCas(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buffer)
-
getResponseStatus(ByteBuf)