Base clase for application handlers. More...
#include <ApplicationHandler.h>
Public Member Functions | |
ApplicationHandler (EventPtr &event) | |
Constructor initializing from an Event object. More... | |
ApplicationHandler (bool urgent=false) | |
Default constructor with m_urgent flag initialization. More... | |
virtual | ~ApplicationHandler () |
Destructor. More... | |
virtual void | run ()=0 |
Carries out the request. More... | |
uint64_t | get_group_id () |
Returns the group ID that this handler belongs to. More... | |
bool | is_urgent () |
Returns true if request is urgent. More... | |
bool | is_expired () |
Returns true if request has expired. More... | |
Protected Attributes | |
EventPtr | m_event |
MESSAGE Event from which handler was initialized. More... | |
bool | m_urgent |
Flag indicating if handler is urgent. More... | |
Base clase for application handlers.
Objects of this type are what get added to an ApplicationQueue. Provides a constructor for initialization from request MESSAGE event received from the comm layer. There are two attributes of a request handler that control how it is treated in the Application queue:
Group ID
The ApplicationQueue supports serial execution of requests that operate on a shared resource. This is achieved through the application request handler group ID. Application request handlers that contain the same group ID will get executed in series. When initialized from a MESSAGE event, the group ID is the same as the CommHeader::gid field of the message header, otherwise it is 0.
Urgency
The ApplicationQueue supports two-level request prioritization. Requests can be designated as urgent which will cause them to be executed before other non-urgent requests. Urgent requests will also be executed even when the ApplicationQueue has been paused. When initialized from a MESSAGE Event, the m_urgent field will get set to true if the CommHeader::FLAGS_BIT_URGENT is set in the CommHeader::flags field of the message header.
Definition at line 67 of file ApplicationHandler.h.
|
inline |
Constructor initializing from an Event object.
Initializes m_event to event
and sets m_urgent to true if the CommHeader::FLAGS_BIT_URGENT is set in the flags field of Event::header member of event
.
event | Event that generated the request |
Definition at line 76 of file ApplicationHandler.h.
|
inline |
Default constructor with m_urgent flag initialization.
urgent | Handler should be marked as urgent |
Definition at line 86 of file ApplicationHandler.h.
|
inlinevirtual |
Destructor.
Definition at line 89 of file ApplicationHandler.h.
|
inline |
Returns the group ID that this handler belongs to.
This value is taken from the associated event object (see Event::group_id) if it exists, otherwise the value is 0 indicating that the handler does not belong to a group.
Definition at line 101 of file ApplicationHandler.h.
|
inline |
Returns true if request has expired.
Definition at line 113 of file ApplicationHandler.h.
|
inline |
Returns true if request is urgent.
Definition at line 108 of file ApplicationHandler.h.
|
pure virtual |
Carries out the request.
Called by an ApplicationQueue worker thread.
Implemented in Hyperspace::RequestHandlerAttrDel, Hyperspace::RequestHandlerAttrExists, Hypertable::RangeServer::Request::Handler::GetStatistics, Hypertable::RangeServer::Request::Handler::SetState, Hypertable::FsBroker::Lib::Request::Handler::Create, Hypertable::FsBroker::Lib::Request::Handler::Debug, Hypertable::FsBroker::Lib::Request::Handler::Length, Hypertable::FsBroker::Lib::Request::Handler::Append, Hypertable::FsBroker::Lib::Request::Handler::Close, Hypertable::FsBroker::Lib::Request::Handler::Exists, Hypertable::FsBroker::Lib::Request::Handler::Flush, Hypertable::FsBroker::Lib::Request::Handler::Mkdirs, Hypertable::FsBroker::Lib::Request::Handler::Open, Hypertable::FsBroker::Lib::Request::Handler::Pread, Hypertable::FsBroker::Lib::Request::Handler::Read, Hypertable::FsBroker::Lib::Request::Handler::Readdir, Hypertable::FsBroker::Lib::Request::Handler::Remove, Hypertable::FsBroker::Lib::Request::Handler::Rename, Hypertable::FsBroker::Lib::Request::Handler::Rmdir, Hypertable::FsBroker::Lib::Request::Handler::Seek, Hypertable::FsBroker::Lib::Request::Handler::Status, Hypertable::FsBroker::Lib::Request::Handler::Sync, Hypertable::RangeServer::Request::Handler::TableMaintenanceDisable, Hypertable::RangeServer::Request::Handler::TableMaintenanceEnable, Hyperspace::RequestHandlerRenewSession, Hypertable::TableMutatorAsyncHandler, Hypertable::RangeServer::Request::Handler::DropRange, Hypertable::RangeServer::Request::Handler::AcknowledgeLoad, Hypertable::RangeServer::Request::Handler::CommitLogSync, Hypertable::RangeServer::Request::Handler::Compact, Hypertable::RangeServer::Request::Handler::CreateScanner, Hypertable::RangeServer::Request::Handler::DestroyScanner, Hypertable::RangeServer::Request::Handler::DoMaintenance, Hypertable::RangeServer::Request::Handler::DropTable, Hypertable::RangeServer::Request::Handler::Dump, Hypertable::RangeServer::Request::Handler::DumpPseudoTable, Hypertable::RangeServer::Request::Handler::FetchScanblock, Hypertable::RangeServer::Request::Handler::GroupCommit, Hypertable::RangeServer::Request::Handler::Heapcheck, Hypertable::RangeServer::Request::Handler::LoadRange, Hypertable::RangeServer::Request::Handler::MetadataSync, Hypertable::RangeServer::Request::Handler::PhantomCommitRanges, Hypertable::RangeServer::Request::Handler::PhantomLoad, Hypertable::RangeServer::Request::Handler::PhantomPrepareRanges, Hypertable::RangeServer::Request::Handler::PhantomUpdate, Hypertable::RangeServer::Request::Handler::RelinquishRange, Hypertable::RangeServer::Request::Handler::ReplayFragments, Hypertable::RangeServer::Request::Handler::Shutdown, Hypertable::RangeServer::Request::Handler::Status, Hypertable::RangeServer::Request::Handler::Update, Hypertable::RangeServer::Request::Handler::UpdateSchema, Hypertable::RangeServer::Request::Handler::WaitForMaintenance, Hyperspace::RequestHandlerShutdown, Hypertable::Lib::Master::EventHandlerMasterChange, Hyperspace::RequestHandlerAttrGet, Hyperspace::RequestHandlerAttrIncr, Hyperspace::RequestHandlerAttrList, Hyperspace::RequestHandlerAttrSet, Hyperspace::RequestHandlerClose, Hyperspace::RequestHandlerDelete, Hyperspace::RequestHandlerExists, Hyperspace::RequestHandlerHandshake, Hyperspace::RequestHandlerLock, Hyperspace::RequestHandlerMkdir, Hyperspace::RequestHandlerOpen, Hyperspace::RequestHandlerReaddir, Hyperspace::RequestHandlerReaddirAttr, Hyperspace::RequestHandlerReadpathAttr, Hyperspace::RequestHandlerRelease, Hyperspace::RequestHandlerStatus, Hyperspace::RequestHandlerDoMaintenance, Hyperspace::RequestHandlerDestroySession, Hyperspace::RequestHandlerExpireSessions, Hypertable::TableScannerHandler, and Hypertable::TableMutatorFlushHandler.
|
protected |
MESSAGE Event from which handler was initialized.
Definition at line 140 of file ApplicationHandler.h.
|
protected |
Flag indicating if handler is urgent.
Definition at line 141 of file ApplicationHandler.h.