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

CODEX_Quorum::SimpleStaticByzantineQuorumSystem< T > Class Template Reference

Smallest possible T-fault-tolerant StaticByzantineQuorumSystem. More...

#include <StaticByzantineQuorumSystem.h>

Inheritance diagram for CODEX_Quorum::SimpleStaticByzantineQuorumSystem< T >:

Inheritance graph
[legend]
Collaboration diagram for CODEX_Quorum::SimpleStaticByzantineQuorumSystem< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SimpleStaticByzantineQuorumSystem (ResponseTracker *aRT)
 Constructor.
virtual ~SimpleStaticByzantineQuorumSystem ()
 Destructor.
unsigned int quorumSystemSize ()
unsigned int quorumSize ()
unsigned int faultsTolerated ()
bool broadcastMessage (const Message &msg, ReturnVector &rets, ResponseCallback *cb)
 Send a message to all the servers in a QuorumSystem.
bool unicastMessage (const MessageVector &msgs, ReturnVector &rets, ResponseCallback *cb=0)
 Send a server-specific message to each server in a QuorumSystem.
void poll (MessageDispatcher &requestDispatcher, QuorumDispatcher &responseDispatcher)
 Poll the RemoteServer%s for incoming messages, storing or dispatching them as appropriate.
void setServer (unsigned int i, RemoteServer *server)
 Set a pointer to a RemoteServer for server slot i.
const RemoteServerserver (unsigned int i) const
 A pointer to the RemoteServer for server slot i.
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

template<int T>
class CODEX_Quorum::SimpleStaticByzantineQuorumSystem< T >

Smallest possible T-fault-tolerant StaticByzantineQuorumSystem.

Definition at line 519 of file StaticByzantineQuorumSystem.h.


Member Function Documentation

bool CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::broadcastMessage const Message msg,
ReturnVector rets,
ResponseCallback cb
[virtual, inherited]
 

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.

Implements CODEX_Quorum::QuorumSystem.

unsigned int CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::faultsTolerated  )  [virtual, inherited]
 

Returns:
The number of faults tolerated by this QuorumSystem.

Implements CODEX_Quorum::QuorumSystem.

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

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 CODEX_Quorum::QuorumSystem::m_responseTracker.

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

void CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::poll MessageDispatcher requestDispatcher,
QuorumDispatcher responseDispatcher
[virtual, inherited]
 

Bug:
The wrong exception is thrown after a failed select(2).

Bug:
Something should probably be done when testing error_set returns true.

Implements CODEX_Quorum::QuorumSystem.

unsigned int CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::quorumSize  )  [virtual, inherited]
 

Returns:
The size of a quorum for this QuorumSystem.

Implements CODEX_Quorum::QuorumSystem.

unsigned int CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::quorumSystemSize  )  [virtual, inherited]
 

Returns:
The number of servers in this QuorumSystem.

Implements CODEX_Quorum::QuorumSystem.

void CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::setServer unsigned int  i,
RemoteServer server
[inherited]
 

Set a pointer to a RemoteServer for server slot i.

The StaticByzantineQuorumSystem takes ownership of the memory. Cleanup can be avoided by setting the server to 0 before destroying the object.

bool CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::unicastMessage const MessageVector msgs,
ReturnVector rets,
ResponseCallback cb = 0
[virtual, inherited]
 

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.

Implements CODEX_Quorum::QuorumSystem.


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