Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CODEX_Quorum::QuorumSystem Class Reference

QuorumSystem is an abstract base class designed to present the basic interface for all quorum systems. More...

#include <QuorumSystem.h>

Inheritance diagram for CODEX_Quorum::QuorumSystem:

Inheritance graph
[legend]
Collaboration diagram for CODEX_Quorum::QuorumSystem:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 QuorumSystem (ResponseTracker *aRT)
 The constructor takes a pointer to a ResponseTracker object, which is used to manage collecting responses to requests that are sent out.
virtual ~QuorumSystem ()
 The destructor frees the memory for the ResponseTracker.
virtual unsigned int quorumSystemSize ()=0
virtual unsigned int quorumSize ()=0
virtual unsigned int faultsTolerated ()=0
virtual bool broadcastMessage (const Message &msg, ReturnVector &rets, ResponseCallback *cb)=0
 Send a message to all the servers in a QuorumSystem.
virtual bool unicastMessage (const MessageVector &msgs, ReturnVector &rets, ResponseCallback *cb=0)=0
 Send a server-specific message to each server in a QuorumSystem.
virtual void poll (MessageDispatcher &requestDispatcher, QuorumDispatcher &responseDispatcher)=0
 Poll the RemoteServer%s for incoming messages, storing or dispatching them as appropriate.
virtual unsigned char * extractKey (const unsigned char *data)
 Forwards a request to ResponseTracker::extractKey().
virtual bool keyRegistered (const unsigned char *key)
 Determines whether a key is registered with the ResponseTracker.

Protected Attributes

ResponseTrackerm_responseTracker
 This is used to match responses to their associated requests.

Detailed Description

QuorumSystem is an abstract base class designed to present the basic interface for all quorum systems.

Definition at line 78 of file QuorumSystem.h.


Constructor & Destructor Documentation

CODEX_Quorum::QuorumSystem::QuorumSystem ResponseTracker aRT  )  [inline]
 

The constructor takes a pointer to a ResponseTracker object, which is used to manage collecting responses to requests that are sent out.

QuorumSystem takes ownership of the ResponseTracker.

Definition at line 87 of file QuorumSystem.h.

References m_responseTracker.


Member Function Documentation

virtual bool CODEX_Quorum::QuorumSystem::broadcastMessage const Message msg,
ReturnVector rets,
ResponseCallback cb
[pure virtual]
 

Send a message to all the servers in a QuorumSystem.

This method only sends messages. It expects the vector rets to be initialized before calling. Repeated calls can be made until sufficient servers have been contacted. The subclass implementation should check the current values of rets before making connections.

The message sent is also registered with the ResponseTracker, since broadcasts are generally requests awaiting replies. This can be prevented by passing a 0 callback. It is advisable in cases where the sender is part of the quorum system for there to be distinct outgoing and incoming server identifiers. For example, the first bit of the first byte might flag whether this is a request being sent by the server or a response to a request from the server. This prevents the request from being treated as a response to itself in ResponseTracker.

All messages should have identifying information for the initiator of the request and a unique ID for the request.

Parameters:
msg A message to broadcast to the QuorumSystem.
rets Vector of RemoteServerReturn%s to the message.
cb If not 0, the request is added to the ResponseTracker using cb as its message callback. This should only be done once for any given request.
Returns:
true if the broadcast was successfully sent to all servers.

Implemented in CODEX_Quorum::StaticByzantineQuorumSystem< N, T >, CODEX_Quorum::StaticByzantineQuorumSystem< nServers, nFaults >, and CODEX_Quorum::StaticByzantineQuorumSystem< 3 *T+1, T >.

Referenced by CODEX_Server::SignRequestHandler::handler(), and CODEX_Server::BroadcastRequestHandler::handler().

virtual unsigned int CODEX_Quorum::QuorumSystem::faultsTolerated  )  [pure virtual]
 

Returns:
The number of faults tolerated by this QuorumSystem.

Implemented in CODEX_Quorum::StaticByzantineQuorumSystem< N, T >, CODEX_Quorum::StaticByzantineQuorumSystem< nServers, nFaults >, and CODEX_Quorum::StaticByzantineQuorumSystem< 3 *T+1, T >.

Referenced by CODEX_KeyService::DelegateResponseVerifier::handler(), CODEX_KeyService::SignWriteCallback::operator()(), CODEX_KeyService::SignReadCallback::operator()(), CODEX_KeyService::SignCreateCallback::operator()(), and CODEX_KeyService::ClientReadCallback::operator()().

virtual bool CODEX_Quorum::QuorumSystem::keyRegistered const unsigned char *  key  )  [inline, virtual]
 

Determines whether a key is registered with the ResponseTracker.

Returns:
Whether the key passed in is registered.

Definition at line 207 of file QuorumSystem.h.

References m_responseTracker.

Referenced by CODEX_Server::UnicastRequestHandler::handler(), and CODEX_Server::BroadcastRequestHandler::handler().

virtual void CODEX_Quorum::QuorumSystem::poll MessageDispatcher requestDispatcher,
QuorumDispatcher responseDispatcher
[pure virtual]
 

Poll the RemoteServer%s for incoming messages, storing or dispatching them as appropriate.

A non-blocking select(2) is used to determine if there is incoming data. New requests are dispatched, and responses are stored in a ResponseTracker until a quorum has been received, at which point they too will be dispatched.

Parameters:
requestDispatcher Functional object that dispatches new requests
responseDispatcher Functional object that dispatches responses from a quorum

Implemented in CODEX_Quorum::StaticByzantineQuorumSystem< N, T >, CODEX_Quorum::StaticByzantineQuorumSystem< nServers, nFaults >, and CODEX_Quorum::StaticByzantineQuorumSystem< 3 *T+1, T >.

virtual unsigned int CODEX_Quorum::QuorumSystem::quorumSize  )  [pure virtual]
 

Returns:
The size of a quorum for this QuorumSystem.

Implemented in CODEX_Quorum::StaticByzantineQuorumSystem< N, T >, CODEX_Quorum::StaticByzantineQuorumSystem< nServers, nFaults >, and CODEX_Quorum::StaticByzantineQuorumSystem< 3 *T+1, T >.

Referenced by CODEX_Server::UnicastRequestHandler::handler(), CODEX_Server::SignRequestHandler::handler(), CODEX_APSS::MessageVerifier::handler(), CODEX_KeyService::DelegateResponseVerifier::handler(), CODEX_Server::BroadcastRequestHandler::handler(), CODEX_KeyService::VerifyWriteCallback::operator()(), CODEX_KeyService::SignWriteCallback::operator()(), CODEX_KeyService::SignReadCallback::operator()(), CODEX_KeyService::SignCreateCallback::operator()(), CODEX_KeyService::ClientWriteCallback::operator()(), CODEX_KeyService::ClientReadCallback::operator()(), and CODEX_KeyService::ClientCreateCallback::operator()().

virtual unsigned int CODEX_Quorum::QuorumSystem::quorumSystemSize  )  [pure virtual]
 

Returns:
The number of servers in this QuorumSystem.

Implemented in CODEX_Quorum::StaticByzantineQuorumSystem< N, T >, CODEX_Quorum::StaticByzantineQuorumSystem< nServers, nFaults >, and CODEX_Quorum::StaticByzantineQuorumSystem< 3 *T+1, T >.

virtual bool CODEX_Quorum::QuorumSystem::unicastMessage const MessageVector msgs,
ReturnVector rets,
ResponseCallback cb = 0
[pure virtual]
 

Send a server-specific message to each server in a QuorumSystem.

This method only sends messages. It expects the vector rets to be initialized before calling. Repeated calls can be made until sufficient servers have been contacted. The subclass implementation should check the current values of rets before making connections.

By default, the message sent is not registered with the ResponseTracker, since unicasts are not generally requests awaiting replies. This behavior can be changed by passing a callback object. It is advisable in cases where the sender is part of the quorum system for there to be distinct outgoing and incoming server identifiers. For example, the first bit of the first byte might flag whether this is a request being sent by the server or a response to a request from the server. This prevents the request from being treated as a response to itself in ResponseTracker.

Parameters:
msgs A set of messages to unicast to the servers in the QuorumSystem.
rets Vector of RemoteServerReturn%s to the messages.
cb If not 0, the request is added to the ResponseTracker using cb as its message callback. This should only be done once for any given request.
Returns:
true if the unicasts were successfully sent to all servers.

Implemented in CODEX_Quorum::StaticByzantineQuorumSystem< N, T >, CODEX_Quorum::StaticByzantineQuorumSystem< nServers, nFaults >, and CODEX_Quorum::StaticByzantineQuorumSystem< 3 *T+1, T >.

Referenced by CODEX_Server::UnicastRequestHandler::handler().


The documentation for this class was generated from the following file:
Generated on Fri May 6 17:42:30 2005 for COrnell Data EXchange (CODEX) by  doxygen 1.4.1