0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | List of all members
Hyperspace::Protocol Class Reference

Protocol driver for encoding request messages. More...

#include <Protocol.h>

Inheritance diagram for Hyperspace::Protocol:
Inheritance graph
[legend]
Collaboration diagram for Hyperspace::Protocol:
Collaboration graph
[legend]

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 CommBufcreate_client_keepalive_request (uint64_t session_id, std::set< uint64_t > &delivered_events, bool destroy_session=false)
 
static CommBufcreate_server_keepalive_request (uint64_t session_id, int error)
 
static CommBufcreate_server_keepalive_request (SessionDataPtr &session_data)
 
static CommBufcreate_server_redirect_request (const std::string &host)
 
static CommBufcreate_handshake_request (uint64_t session_id, const std::string &name)
 
static CommBufcreate_open_request (const std::string &name, uint32_t flags, HandleCallbackPtr &callback, const std::vector< Attribute > &init_attrs)
 
static CommBufcreate_close_request (uint64_t handle)
 
static CommBufcreate_mkdir_request (const std::string &name, bool create_intermediate, const std::vector< Attribute > *init_attrs)
 
static CommBufcreate_delete_request (const std::string &name)
 
static CommBufcreate_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 CommBufcreate_attr_set_request (uint64_t handle, const std::string *name, uint32_t oflags, const std::vector< Attribute > &attrs)
 
static CommBufcreate_attr_incr_request (uint64_t handle, const std::string *name, const std::string &attr)
 
static CommBufcreate_attr_get_request (uint64_t handle, const std::string *name, const std::string &attr)
 
static CommBufcreate_attrs_get_request (uint64_t handle, const std::string *name, const std::vector< std::string > &attrs)
 
static CommBufcreate_attr_del_request (uint64_t handle, const std::string &name)
 Creates attr_del request message. More...
 
static CommBufcreate_attr_exists_request (uint64_t handle, const std::string &attr)
 Creates attr_exists request message. More...
 
static CommBufcreate_attr_exists_request (const std::string &name, const std::string &attr)
 Creates attr_exists request message. More...
 
static CommBufcreate_attr_list_request (uint64_t handle)
 
static CommBufcreate_readdir_request (uint64_t handle)
 
static CommBufcreate_readdir_attr_request (uint64_t handle, const std::string *name, const std::string &attr, bool include_sub_entries)
 
static CommBufcreate_readpath_attr_request (uint64_t handle, const std::string *name, const std::string &attr)
 
static CommBufcreate_exists_request (const std::string &name)
 
static CommBufcreate_lock_request (uint64_t handle, uint32_t mode, bool try_lock)
 
static CommBufcreate_release_request (uint64_t handle)
 
static CommBufcreate_event_notification (uint64_t handle, const std::string &name, const void *value, size_t value_len)
 
static CommBufcreate_status_request ()
 
static CommBufcreate_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...
 

Detailed Description

Protocol driver for encoding request messages.

Definition at line 69 of file Protocol.h.

Member Function Documentation

const char * Hyperspace::Protocol::command_text ( uint64_t  command)
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.

Parameters
commandCommand code
Returns
Pointer to human readable string mnemonic for command.

Implements Hypertable::Protocol.

Definition at line 79 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_attr_del_request ( uint64_t  handle,
const std::string &  name 
)
static

Creates attr_del request message.

This method creates a CommBuf object holding an attr_del request message. The message is encoded as follows:

EncodingDescription
i64File handle
vstrAttribute name

The gid field of the header is set to the XOR of the upper and lower dwords of handle.

Parameters
handleFile handle
nameAttribute name
Returns
Heap allocated comm buffer holding request

Definition at line 379 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_attr_exists_request ( uint64_t  handle,
const std::string &  attr 
)
static

Creates attr_exists request message.

This method creates a CommBuf object holding an attr_exists request message. The message is encoded as follows:

EncodingDescription
boolfalse
i64File handle
vstrAttribute name

The gid field of the header is set to the XOR of the upper and lower dwords of handle.

Parameters
handleFile handle
attrAttribute name
Returns
Heap allocated comm buffer holding request

Definition at line 390 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_attr_exists_request ( const std::string &  name,
const std::string &  attr 
)
static

Creates attr_exists request message.

This method creates a CommBuf object holding an attr_exists request message. The message is encoded as follows:

EncodingDescription
booltrue
vstrFile name
vstrAttribute name

The gid field of the header is set to the return value of filename_to_group() called with name. lower dwords of handle.

Parameters
nameFile name
attrAttribute name
Returns
Heap allocated comm buffer holding request

Definition at line 403 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_attr_get_request ( uint64_t  handle,
const std::string *  name,
const std::string &  attr 
)
static

Definition at line 325 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_attr_incr_request ( uint64_t  handle,
const std::string *  name,
const std::string &  attr 
)
static

Definition at line 302 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_attr_list_request ( uint64_t  handle)
static

Definition at line 417 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::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

Definition at line 243 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_attr_set_request ( uint64_t  handle,
const std::string *  name,
uint32_t  oflags,
const std::vector< Attribute > &  attrs 
)
static

Definition at line 270 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_attrs_get_request ( uint64_t  handle,
const std::string *  name,
const std::vector< std::string > &  attrs 
)
static

Definition at line 349 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_client_keepalive_request ( uint64_t  session_id,
std::set< uint64_t > &  delivered_events,
bool  destroy_session = false 
)
static

Definition at line 89 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_close_request ( uint64_t  handle)
static

Definition at line 200 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_delete_request ( const std::string &  name)
static

Definition at line 233 of file Protocol.cc.

static CommBuf* Hyperspace::Protocol::create_event_notification ( uint64_t  handle,
const std::string &  name,
const void *  value,
size_t  value_len 
)
static
CommBuf * Hyperspace::Protocol::create_exists_request ( const std::string &  name)
static

Definition at line 476 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_handshake_request ( uint64_t  session_id,
const std::string &  name 
)
static

Definition at line 149 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_lock_request ( uint64_t  handle,
uint32_t  mode,
bool  try_lock 
)
static

Definition at line 486 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_mkdir_request ( const std::string &  name,
bool  create_intermediate,
const std::vector< Attribute > *  init_attrs 
)
static

Definition at line 208 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_open_request ( const std::string &  name,
uint32_t  flags,
HandleCallbackPtr callback,
const std::vector< Attribute > &  init_attrs 
)
static

Definition at line 165 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_readdir_attr_request ( uint64_t  handle,
const std::string *  name,
const std::string &  attr,
bool  include_sub_entries 
)
static

Definition at line 433 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_readdir_request ( uint64_t  handle)
static

Definition at line 425 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_readpath_attr_request ( uint64_t  handle,
const std::string *  name,
const std::string &  attr 
)
static

Definition at line 455 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_release_request ( uint64_t  handle)
static

Definition at line 498 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_server_keepalive_request ( uint64_t  session_id,
int  error 
)
static

Definition at line 107 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_server_keepalive_request ( SessionDataPtr session_data)
static

Definition at line 123 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_server_redirect_request ( const std::string &  host)
static

Definition at line 137 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_shutdown_request ( )
static

Definition at line 518 of file Protocol.cc.

CommBuf * Hyperspace::Protocol::create_status_request ( )
static

Definition at line 510 of file Protocol.cc.

static uint32_t Hyperspace::Protocol::filename_to_group ( const std::string &  path)
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.

Parameters
pathPathname
Returns
Comm header gid for path

Definition at line 219 of file Protocol.h.

Member Data Documentation

const uint64_t Hyperspace::Protocol::COMMAND_ATTRDEL = 10
static

Definition at line 190 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_ATTREXISTS = 11
static

Definition at line 191 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_ATTRGET = 9
static

Definition at line 189 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_ATTRINCR = 22
static

Definition at line 202 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_ATTRLIST = 12
static

Definition at line 192 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_ATTRSET = 8
static

Definition at line 188 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_CANCEL = 4
static

Definition at line 184 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_CHECKSEQUENCER = 18
static

Definition at line 198 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_CLOSE = 5
static

Definition at line 185 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_DELETE = 14
static

Definition at line 194 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_EXISTS = 13
static

Definition at line 193 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_HANDSHAKE = 1
static

Definition at line 181 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_KEEPALIVE = 0
static

Definition at line 180 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_LOCK = 16
static

Definition at line 196 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_MAX = 25
static

Definition at line 205 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_MKDIR = 7
static

Definition at line 187 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_OPEN = 2
static

Definition at line 182 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_POISON = 6
static

Definition at line 186 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_READDIR = 15
static

Definition at line 195 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_READDIRATTR = 21
static

Definition at line 201 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_READPATHATTR = 23
static

Definition at line 203 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_REDIRECT = 20
static

Definition at line 200 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_RELEASE = 17
static

Definition at line 197 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_SHUTDOWN = 24
static

Definition at line 204 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_STAT = 3
static

Definition at line 183 of file Protocol.h.

const uint64_t Hyperspace::Protocol::COMMAND_STATUS = 19
static

Definition at line 199 of file Protocol.h.

const char * Hyperspace::Protocol::command_strs
static
Initial value:
= {
"keepalive",
"handshake",
"open",
"stat",
"cancel",
"close",
"poison",
"mkdir",
"attrset",
"attrget",
"attrdel",
"attrexists",
"attrlist",
"exists",
"delete",
"readdir",
"lock",
"release",
"checksequencer",
"status",
"redirect",
"readdirattr",
"attrincr",
"readpathattr",
"shutdown"
}

Definition at line 207 of file Protocol.h.

const int Hyperspace::Protocol::Version = 0xf0000002
static

Definition at line 75 of file Protocol.h.


The documentation for this class was generated from the following files: