Network communication library. More...
Namespaces | |
Hypertable::PollEvent | |
Polling event constants (mechanism-independent). | |
Classes | |
class | Hypertable::ApplicationHandler |
Base clase for application handlers. More... | |
class | Hypertable::ApplicationQueue |
Application queue. More... | |
class | Hypertable::ApplicationQueue::GroupState |
Tracks group execution state. More... | |
class | Hypertable::ApplicationQueue::RequestRec |
Request record. More... | |
class | Hypertable::ApplicationQueue::ApplicationQueueState |
Application queue state shared among worker threads. More... | |
class | Hypertable::ApplicationQueue::Worker |
Application queue worker thread function (functor) More... | |
class | Hypertable::ApplicationQueueInterface |
Abstract interface for application queue. More... | |
class | Hypertable::Comm |
Entry point to AsyncComm service. More... | |
class | Hypertable::CommAddress |
Address abstraction to hold either proxy name or IPv4:port address. More... | |
class | Hypertable::CommAddressHash |
Hash function (functor) for CommAddress objets. More... | |
class | Hypertable::CommAddressMap< TypeT, addr > |
Parameterized hash map for mapping CommAddress to arbitrary type. More... | |
class | Hypertable::CommBuf |
Message buffer for holding data to be transmitted over a network. More... | |
class | Hypertable::CommHeader |
Header for messages transmitted via AsyncComm. More... | |
struct | Hypertable::Config::CommPolicy |
Config policy for Comm layer. More... | |
struct | Hypertable::Config::GenericServerPolicy |
Config policy for generic Comm layer server. More... | |
class | Hypertable::ConnectionHandlerFactory |
Abstract class for creating default application dispatch handlers. More... | |
class | Hypertable::ConnectionInitializer |
Driver interface for connection initialization handshake in ConnectionManager. More... | |
class | Hypertable::ConnectionManager |
Establishes and maintains a set of TCP connections. More... | |
class | Hypertable::ConnectionManager::ConnectionState |
Per-connection state. More... | |
struct | Hypertable::ConnectionManager::LtConnectionState |
StringWeakOrdering for connection retry heap. More... | |
class | Hypertable::ConnectionManager::SharedImpl |
Connection manager state shared between Connection manager objects. More... | |
class | Hypertable::DispatchHandler |
Abstract base class for application dispatch handlers registered with AsyncComm. More... | |
class | Hypertable::DispatchHandlerSynchronizer |
DispatchHandler class used to synchronize with response messages. More... | |
class | Hypertable::Event |
Network communication event. More... | |
struct | Hypertable::ExpireTimer |
State record for timer. More... | |
struct | Hypertable::LtTimerHeap |
Comparison function (functor) for timer heap. More... | |
class | Hypertable::HandlerMap |
Data structure for mapping socket addresses to I/O handlers. More... | |
class | Hypertable::IOHandler |
Base class for socket descriptor I/O handlers. More... | |
class | Hypertable::IOHandlerAccept |
I/O handler for accept (listen) sockets. More... | |
class | Hypertable::IOHandlerData |
I/O handler for TCP sockets. More... | |
class | Hypertable::IOHandlerDatagram |
I/O handler for datagram (UDP) sockets. More... | |
class | Hypertable::IOHandlerRaw |
I/O handler for raw sockets. More... | |
class | Hypertable::PollTimeout |
Maintains next timeout for event polling loop. More... | |
class | Hypertable::Protocol |
Abstract base class for server protocol drivers. More... | |
class | Hypertable::ProxyAddressInfo |
Holds address and hostname associated with a proxy name. More... | |
class | Hypertable::ProxyMap |
Maps a set of proxy names to their associated IP addresses. More... | |
class | Hypertable::RawSocketHandler |
Abstract base class for application raw socket handlers registered with AsyncComm. More... | |
struct | Hypertable::PollDescriptorT |
Socket descriptor poll state for use with POSIX poll() More... | |
class | Hypertable::Reactor |
Manages reactor (polling thread) state including poll interest, request cache, and timers. More... | |
class | Hypertable::ReactorFactory |
Static class used to setup and manage I/O reactors. More... | |
class | Hypertable::ReactorRunner |
Thread functor class for reacting to I/O events. More... | |
class | Hypertable::RequestCache |
Class used to hold pending request callback handlers. More... | |
class | Hypertable::RequestCache::CacheNode |
Internal cache node structure. More... | |
class | Hypertable::ResponseCallback |
This class is used to generate and deliver standard responses back to a client. More... | |
Typedefs | |
typedef std::shared_ptr < ApplicationQueue > | Hypertable::ApplicationQueuePtr |
Shared smart pointer to ApplicationQueue object. More... | |
typedef std::shared_ptr < ApplicationQueueInterface > | Hypertable::ApplicationQueueInterfacePtr |
Smart pointer to ApplicationQueueInterface. More... | |
typedef std::chrono::fast_clock | Hypertable::ClockT |
Clock used for AsyncComm timing needs. More... | |
typedef std::set< CommAddress > | Hypertable::CommAddressSet |
Set of CommAddress objects. More... | |
typedef std::shared_ptr< CommBuf > | Hypertable::CommBufPtr |
Smart pointer to CommBuf. More... | |
typedef Cons< DefaultPolicy, CommPolicy > | Hypertable::Config::DefaultCommPolicy |
Default comm layer config policy. More... | |
typedef Cons < GenericServerPolicy, DefaultCommPolicy > | Hypertable::Config::DefaultServerPolicy |
Default comm layer server policy. More... | |
typedef std::shared_ptr < ConnectionHandlerFactory > | Hypertable::ConnectionHandlerFactoryPtr |
Smart pointer to ConnectionHandlerFactory. More... | |
typedef std::shared_ptr < ConnectionInitializer > | Hypertable::ConnectionInitializerPtr |
Smart pointer to ConnectionInitializer. More... | |
typedef std::shared_ptr < ConnectionManager > | Hypertable::ConnectionManagerPtr |
Smart pointer to ConnectionManager. More... | |
typedef std::shared_ptr < DispatchHandler > | Hypertable::DispatchHandlerPtr |
Smart pointer to DispatchHandler. More... | |
typedef std::shared_ptr < DispatchHandlerSynchronizer > | Hypertable::DispatchHandlerSynchronizerPtr |
Shared smart pointer to DispatchHandlerSynchronizer. More... | |
typedef std::shared_ptr< Event > | Hypertable::EventPtr |
Smart pointer to Event. More... | |
typedef std::shared_ptr < HandlerMap > | Hypertable::HandlerMapPtr |
Smart pointer to HandlerMap. More... | |
typedef std::unordered_map < String, ProxyAddressInfo > | Hypertable::ProxyMapT |
Forward mapping hash type from proxy name to ProxyAddressInfo. More... | |
typedef std::shared_ptr< Reactor > | Hypertable::ReactorPtr |
Shared smart pointer to Reactor. More... | |
typedef std::unordered_map < uint32_t, CacheNode * > | Hypertable::RequestCache::IdHandlerMap |
RequestID-to-CacheNode map. More... | |
Functions | |
void | Hypertable::Config::init_comm_options () |
Initializes Comm-layer options. More... | |
void | Hypertable::Config::init_comm () |
This method initializes the Comm-layer. More... | |
void | Hypertable::Config::init_generic_server_options () |
Initializes generic server options. More... | |
void | Hypertable::Config::init_generic_server () |
Initializes generic server by writing the pidfile. More... | |
Hypertable::RequestCache::CacheNode::CacheNode (uint32_t id, IOHandler *handler, DispatchHandler *dh) | |
Hypertable::RequestCache::RequestCache () | |
Constructor. More... | |
void | Hypertable::RequestCache::insert (uint32_t id, IOHandler *handler, DispatchHandler *dh, ClockT::time_point &expire) |
Inserts pending request callback handler into cache. More... | |
bool | Hypertable::RequestCache::remove (uint32_t id, DispatchHandler *&handler) |
Removes a request from the cache. More... | |
bool | Hypertable::RequestCache::get_next_timeout (ClockT::time_point &now, IOHandler *&handlerp, DispatchHandler *&dh, ClockT::time_point *next_timeout) |
Removes next request that has timed out. More... | |
void | Hypertable::RequestCache::purge_requests (IOHandler *handler, int32_t error) |
Purges all requests assocated with handler . More... | |
Variables | |
CacheNode * | Hypertable::RequestCache::CacheNode::prev |
CacheNode * | Hypertable::RequestCache::CacheNode::next |
Doubly-linked list pointers. More... | |
ClockT::time_point | Hypertable::RequestCache::CacheNode::expire |
Absolute expiration time. More... | |
uint32_t | Hypertable::RequestCache::CacheNode::id |
Request ID. More... | |
IOHandler * | Hypertable::RequestCache::CacheNode::handler |
IOHandler associated with this request. More... | |
DispatchHandler * | Hypertable::RequestCache::CacheNode::dh |
Callback handler to which MESSAGE, TIMEOUT, ERROR, and DISCONNECT events are delivered. More... | |
IdHandlerMap | Hypertable::RequestCache::m_id_map |
RequestID-to-CacheNode map. More... | |
CacheNode * | Hypertable::RequestCache::m_head |
Head of doubly-linked list. More... | |
CacheNode * | Hypertable::RequestCache::m_tail {} |
Tail of doubly-linked list. More... | |
Network communication library.
The AsyncComm module is designed for maximally efficient network programming by 1) providing an asynchronous API to facilitate multiprogramming, and 2) using the most efficient polling mechanism for each supported system (epoll
on Linux, kqueue
on OSX and FreeBSD, and port_associate
on Solaris).
typedef std::shared_ptr<ApplicationQueueInterface> Hypertable::ApplicationQueueInterfacePtr |
Smart pointer to ApplicationQueueInterface.
Definition at line 60 of file ApplicationQueueInterface.h.
typedef std::shared_ptr<ApplicationQueue> Hypertable::ApplicationQueuePtr |
Shared smart pointer to ApplicationQueue object.
Definition at line 488 of file ApplicationQueue.h.
typedef std::set<CommAddress> Hypertable::CommAddressSet |
Set of CommAddress objects.
Definition at line 212 of file CommAddress.h.
typedef std::shared_ptr<CommBuf> Hypertable::CommBufPtr |
typedef std::shared_ptr<ConnectionHandlerFactory> Hypertable::ConnectionHandlerFactoryPtr |
Smart pointer to ConnectionHandlerFactory.
Definition at line 53 of file ConnectionHandlerFactory.h.
typedef std::shared_ptr<ConnectionInitializer> Hypertable::ConnectionInitializerPtr |
Smart pointer to ConnectionInitializer.
Definition at line 67 of file ConnectionInitializer.h.
typedef std::shared_ptr<ConnectionManager> Hypertable::ConnectionManagerPtr |
Smart pointer to ConnectionManager.
Definition at line 410 of file ConnectionManager.h.
typedef Cons<DefaultPolicy, CommPolicy> Hypertable::Config::DefaultCommPolicy |
typedef Cons<GenericServerPolicy, DefaultCommPolicy> Hypertable::Config::DefaultServerPolicy |
typedef std::shared_ptr<DispatchHandler> Hypertable::DispatchHandlerPtr |
Smart pointer to DispatchHandler.
Definition at line 64 of file DispatchHandler.h.
typedef std::shared_ptr<DispatchHandlerSynchronizer> Hypertable::DispatchHandlerSynchronizerPtr |
Shared smart pointer to DispatchHandlerSynchronizer.
Definition at line 127 of file DispatchHandlerSynchronizer.h.
typedef std::shared_ptr<Event> Hypertable::EventPtr |
typedef std::shared_ptr<HandlerMap> Hypertable::HandlerMapPtr |
Smart pointer to HandlerMap.
Definition at line 437 of file HandlerMap.h.
|
private |
RequestID-to-CacheNode map.
Definition at line 68 of file RequestCache.h.
typedef std::unordered_map<String, ProxyAddressInfo> Hypertable::ProxyMapT |
Forward mapping hash type from proxy name to ProxyAddressInfo.
Definition at line 57 of file ProxyMap.h.
typedef std::shared_ptr<Reactor> Hypertable::ReactorPtr |
Enumeration for address type.
Enumerator | |
---|---|
NONE |
Uninitialized. |
PROXY |
Proxy name type. |
INET |
IPv4:port address type. |
Definition at line 57 of file CommAddress.h.
Enumeration constants for flags field bitmaks.
Enumerator | |
---|---|
FLAGS_MASK_REQUEST |
Request message bit. |
FLAGS_MASK_IGNORE_RESPONSE |
Response should be ignored bit. |
FLAGS_MASK_URGENT |
Request is urgent bit. |
FLAGS_MASK_PROFILE |
Request should be profiled. |
FLAGS_MASK_PROXY_MAP_UPDATE |
ProxyMap update message bit. |
FLAGS_MASK_PAYLOAD_CHECKSUM |
Payload checksumming is enabled bit. |
Definition at line 61 of file CommHeader.h.
Enumeration for poll interest constants.
Definition at line 40 of file PollEvent.h.
Enumeration constants for bits in flags field.
Enumerator | |
---|---|
FLAGS_BIT_REQUEST |
Request message. |
FLAGS_BIT_IGNORE_RESPONSE |
Response should be ignored. |
FLAGS_BIT_URGENT |
Request is urgent. |
FLAGS_BIT_PROFILE |
Request should be profiled. |
FLAGS_BIT_PROXY_MAP_UPDATE |
ProxyMap update message. |
FLAGS_BIT_PAYLOAD_CHECKSUM |
Payload checksumming is enabled. |
Definition at line 50 of file CommHeader.h.
|
strong |
|
strongprivate |
Enumerator | |
---|---|
DISCONNECTED | |
CONNECTED | |
READY | |
DECOMMISSIONED |
Definition at line 62 of file ConnectionManager.h.
|
inline |
Definition at line 56 of file RequestCache.h.
bool RequestCache::get_next_timeout | ( | ClockT::time_point & | now, |
IOHandler *& | handlerp, | ||
DispatchHandler *& | dh, | ||
ClockT::time_point * | next_timeout | ||
) |
Removes next request that has timed out.
This method finds the first request starting from the head of the list and removes it and returns it's associated handler information if it has timed out. During the search, it physically removes any cache nodes corresponding to requests that have been purged.
now | Current time |
handlerp | Return parameter to hold pointer to associated IOHandler of timed out request |
dh | Removed dispatch handler |
next_timeout | Pointer to variable to hold expiration time of next request after timed out request, set to 0 if cache is empty |
Definition at line 103 of file RequestCache.cc.
void Hypertable::Config::init_comm | ( | ) |
This method initializes the Comm-layer.
It determines the reactor count from the reactors property, if specified, otherwise sets the reactor count to the number of CPU cores as returned by System::get_processor_count(). It then calls ReactorFactory::initialize.
void Hypertable::Config::init_comm_options | ( | ) |
void Hypertable::Config::init_generic_server | ( | ) |
void Hypertable::Config::init_generic_server_options | ( | ) |
void RequestCache::insert | ( | uint32_t | id, |
IOHandler * | handler, | ||
DispatchHandler * | dh, | ||
ClockT::time_point & | expire | ||
) |
Inserts pending request callback handler into cache.
id | Request ID |
handler | IOHandler associated with |
dh | Callback handler to which MESSAGE, TIMEOUT, DISCONNECT events are delivered |
expire | Absolute expiration time of request |
Definition at line 43 of file RequestCache.cc.
void RequestCache::purge_requests | ( | IOHandler * | handler, |
int32_t | error | ||
) |
Purges all requests assocated with handler
.
This method walks the entire cache and purges all requests whose handler is equal to handler
. For each purged request, an ERROR event with error code error
is delivered via the request's dispatch handler.
Definition at line 140 of file RequestCache.cc.
bool RequestCache::remove | ( | uint32_t | id, |
DispatchHandler *& | handler | ||
) |
Removes a request from the cache.
id | Request ID |
handler | Removed dispatch handler |
Definition at line 70 of file RequestCache.cc.
|
inline |
Constructor.
Definition at line 73 of file RequestCache.h.
DispatchHandler* Hypertable::RequestCache::CacheNode::dh |
Callback handler to which MESSAGE, TIMEOUT, ERROR, and DISCONNECT events are delivered.
Definition at line 64 of file RequestCache.h.
ClockT::time_point Hypertable::RequestCache::CacheNode::expire |
Absolute expiration time.
Definition at line 59 of file RequestCache.h.
IOHandler* Hypertable::RequestCache::CacheNode::handler |
IOHandler associated with this request.
Definition at line 61 of file RequestCache.h.
uint32_t Hypertable::RequestCache::CacheNode::id |
Request ID.
Definition at line 60 of file RequestCache.h.
|
private |
Head of doubly-linked list.
Definition at line 122 of file RequestCache.h.
|
private |
RequestID-to-CacheNode map.
Definition at line 121 of file RequestCache.h.
|
private |
Tail of doubly-linked list.
Definition at line 123 of file RequestCache.h.
CacheNode * Hypertable::RequestCache::CacheNode::next |
Doubly-linked list pointers.
Definition at line 58 of file RequestCache.h.
CacheNode* Hypertable::RequestCache::CacheNode::prev |
Definition at line 58 of file RequestCache.h.