Protocol driver for encoding request messages. More...
#include <Protocol.h>
Public Member Functions | |
virtual const char * | command_text (uint64_t command) |
Returns the string representation of a command code. More... | |
Public Member Functions inherited from Hypertable::Protocol | |
virtual | ~Protocol () |
Destructor. More... | |
Static Public Member Functions | |
static CommBuf * | create_client_keepalive_request (uint64_t session_id, std::set< uint64_t > &delivered_events, bool destroy_session=false) |
static CommBuf * | create_server_keepalive_request (uint64_t session_id, int error) |
static CommBuf * | create_server_keepalive_request (SessionDataPtr &session_data) |
static CommBuf * | create_server_redirect_request (const std::string &host) |
static CommBuf * | create_handshake_request (uint64_t session_id, const std::string &name) |
static CommBuf * | create_open_request (const std::string &name, uint32_t flags, HandleCallbackPtr &callback, const std::vector< Attribute > &init_attrs) |
static CommBuf * | create_close_request (uint64_t handle) |
static CommBuf * | create_mkdir_request (const std::string &name, bool create_intermediate, const std::vector< Attribute > *init_attrs) |
static CommBuf * | create_delete_request (const std::string &name) |
static CommBuf * | create_attr_set_request (uint64_t handle, const std::string *name, uint32_t oflags, const std::string &attr, const void *value, size_t value_len) |
static CommBuf * | create_attr_set_request (uint64_t handle, const std::string *name, uint32_t oflags, const std::vector< Attribute > &attrs) |
static CommBuf * | create_attr_incr_request (uint64_t handle, const std::string *name, const std::string &attr) |
static CommBuf * | create_attr_get_request (uint64_t handle, const std::string *name, const std::string &attr) |
static CommBuf * | create_attrs_get_request (uint64_t handle, const std::string *name, const std::vector< std::string > &attrs) |
static CommBuf * | create_attr_del_request (uint64_t handle, const std::string &name) |
Creates attr_del request message. More... | |
static CommBuf * | create_attr_exists_request (uint64_t handle, const std::string &attr) |
Creates attr_exists request message. More... | |
static CommBuf * | create_attr_exists_request (const std::string &name, const std::string &attr) |
Creates attr_exists request message. More... | |
static CommBuf * | create_attr_list_request (uint64_t handle) |
static CommBuf * | create_readdir_request (uint64_t handle) |
static CommBuf * | create_readdir_attr_request (uint64_t handle, const std::string *name, const std::string &attr, bool include_sub_entries) |
static CommBuf * | create_readpath_attr_request (uint64_t handle, const std::string *name, const std::string &attr) |
static CommBuf * | create_exists_request (const std::string &name) |
static CommBuf * | create_lock_request (uint64_t handle, uint32_t mode, bool try_lock) |
static CommBuf * | create_release_request (uint64_t handle) |
static CommBuf * | create_event_notification (uint64_t handle, const std::string &name, const void *value, size_t value_len) |
static CommBuf * | create_status_request () |
static CommBuf * | create_shutdown_request () |
Static Public Member Functions inherited from Hypertable::Protocol | |
static int32_t | response_code (const Event *event) |
Returns the response code from an event event generated in response to a request message. More... | |
static int32_t | response_code (const EventPtr &event) |
Returns the response code from an event event generated in response to a request message. More... | |
static String | string_format_message (const Event *event) |
Returns error message decoded standard error MESSAGE generated in response to a request message. More... | |
static String | string_format_message (const EventPtr &event) |
Returns error message decoded from standard error MESSAGE generated in response to a request message. More... | |
static CommBufPtr | create_error_message (CommHeader &header, int error, const char *msg) |
Creates a standard error message response. More... | |
Static Public Attributes | |
static const int | Version = 0xf0000002 |
static const uint64_t | COMMAND_KEEPALIVE = 0 |
static const uint64_t | COMMAND_HANDSHAKE = 1 |
static const uint64_t | COMMAND_OPEN = 2 |
static const uint64_t | COMMAND_STAT = 3 |
static const uint64_t | COMMAND_CANCEL = 4 |
static const uint64_t | COMMAND_CLOSE = 5 |
static const uint64_t | COMMAND_POISON = 6 |
static const uint64_t | COMMAND_MKDIR = 7 |
static const uint64_t | COMMAND_ATTRSET = 8 |
static const uint64_t | COMMAND_ATTRGET = 9 |
static const uint64_t | COMMAND_ATTRDEL = 10 |
static const uint64_t | COMMAND_ATTREXISTS = 11 |
static const uint64_t | COMMAND_ATTRLIST = 12 |
static const uint64_t | COMMAND_EXISTS = 13 |
static const uint64_t | COMMAND_DELETE = 14 |
static const uint64_t | COMMAND_READDIR = 15 |
static const uint64_t | COMMAND_LOCK = 16 |
static const uint64_t | COMMAND_RELEASE = 17 |
static const uint64_t | COMMAND_CHECKSEQUENCER = 18 |
static const uint64_t | COMMAND_STATUS = 19 |
static const uint64_t | COMMAND_REDIRECT = 20 |
static const uint64_t | COMMAND_READDIRATTR = 21 |
static const uint64_t | COMMAND_ATTRINCR = 22 |
static const uint64_t | COMMAND_READPATHATTR = 23 |
static const uint64_t | COMMAND_SHUTDOWN = 24 |
static const uint64_t | COMMAND_MAX = 25 |
static const char * | command_strs [COMMAND_MAX] |
Static Private Member Functions | |
static uint32_t | filename_to_group (const std::string &path) |
Generates Comm header gid for pathname. More... | |
Protocol driver for encoding request messages.
Definition at line 69 of file Protocol.h.
|
virtual |
Returns the string representation of a command code.
Each protocol defines a set of command codes that are sent in the CommHeader::command field of a reqeust's message header to indicate which server command (method) is to be executed. This method returns a human readable string mnemonic for the command.
command | Command code |
command
. Implements Hypertable::Protocol.
Definition at line 79 of file Protocol.cc.
|
static |
Creates attr_del request message.
This method creates a CommBuf object holding an attr_del request message. The message is encoded as follows:
Encoding | Description |
---|---|
i64 | File handle |
vstr | Attribute name |
The gid field of the header is set to the XOR of the upper and lower dwords of handle
.
handle | File handle |
name | Attribute name |
Definition at line 379 of file Protocol.cc.
|
static |
Creates attr_exists request message.
This method creates a CommBuf object holding an attr_exists request message. The message is encoded as follows:
Encoding | Description |
---|---|
bool | false |
i64 | File handle |
vstr | Attribute name |
The gid field of the header is set to the XOR of the upper and lower dwords of handle
.
handle | File handle |
attr | Attribute name |
Definition at line 390 of file Protocol.cc.
|
static |
Creates attr_exists request message.
This method creates a CommBuf object holding an attr_exists request message. The message is encoded as follows:
Encoding | Description |
---|---|
bool | true |
vstr | File name |
vstr | Attribute name |
The gid field of the header is set to the return value of filename_to_group() called with name
. lower dwords of handle
.
name | File name |
attr | Attribute name |
Definition at line 403 of file Protocol.cc.
|
static |
Definition at line 325 of file Protocol.cc.
|
static |
Definition at line 302 of file Protocol.cc.
|
static |
Definition at line 417 of file Protocol.cc.
|
static |
Definition at line 243 of file Protocol.cc.
|
static |
Definition at line 270 of file Protocol.cc.
|
static |
Definition at line 349 of file Protocol.cc.
|
static |
Definition at line 89 of file Protocol.cc.
|
static |
Definition at line 200 of file Protocol.cc.
|
static |
Definition at line 233 of file Protocol.cc.
|
static |
|
static |
Definition at line 476 of file Protocol.cc.
|
static |
Definition at line 149 of file Protocol.cc.
|
static |
Definition at line 486 of file Protocol.cc.
|
static |
Definition at line 208 of file Protocol.cc.
|
static |
Definition at line 165 of file Protocol.cc.
|
static |
Definition at line 433 of file Protocol.cc.
|
static |
Definition at line 425 of file Protocol.cc.
|
static |
Definition at line 455 of file Protocol.cc.
|
static |
Definition at line 498 of file Protocol.cc.
|
static |
Definition at line 107 of file Protocol.cc.
|
static |
Definition at line 123 of file Protocol.cc.
|
static |
Definition at line 137 of file Protocol.cc.
|
static |
Definition at line 518 of file Protocol.cc.
|
static |
Definition at line 510 of file Protocol.cc.
|
inlinestaticprivate |
Generates Comm header gid for pathname.
Generates a gid for path
by summing the character codes in the pathname. It first normalizes the pathname by adding a leading '/' character if it does not already exist and stripping any trailing '/' character.
path | Pathname |
path
Definition at line 219 of file Protocol.h.
|
static |
Definition at line 190 of file Protocol.h.
|
static |
Definition at line 191 of file Protocol.h.
|
static |
Definition at line 189 of file Protocol.h.
|
static |
Definition at line 202 of file Protocol.h.
|
static |
Definition at line 192 of file Protocol.h.
|
static |
Definition at line 188 of file Protocol.h.
|
static |
Definition at line 184 of file Protocol.h.
|
static |
Definition at line 198 of file Protocol.h.
|
static |
Definition at line 185 of file Protocol.h.
|
static |
Definition at line 194 of file Protocol.h.
|
static |
Definition at line 193 of file Protocol.h.
|
static |
Definition at line 181 of file Protocol.h.
|
static |
Definition at line 180 of file Protocol.h.
|
static |
Definition at line 196 of file Protocol.h.
|
static |
Definition at line 205 of file Protocol.h.
|
static |
Definition at line 187 of file Protocol.h.
|
static |
Definition at line 182 of file Protocol.h.
|
static |
Definition at line 186 of file Protocol.h.
|
static |
Definition at line 195 of file Protocol.h.
|
static |
Definition at line 201 of file Protocol.h.
|
static |
Definition at line 203 of file Protocol.h.
|
static |
Definition at line 200 of file Protocol.h.
|
static |
Definition at line 197 of file Protocol.h.
|
static |
Definition at line 204 of file Protocol.h.
|
static |
Definition at line 183 of file Protocol.h.
|
static |
Definition at line 199 of file Protocol.h.
|
static |
Definition at line 207 of file Protocol.h.
|
static |
Definition at line 75 of file Protocol.h.