Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

CODEX_Quorum::StaticByzantineQuorumSystem< N, T > Class Template Reference

A compile-time configured Byzantine quorum system. More...

#include <StaticByzantineQuorumSystem.h>

Inheritance diagram for CODEX_Quorum::StaticByzantineQuorumSystem< N, T >:

Inheritance graph
[legend]
Collaboration diagram for CODEX_Quorum::StaticByzantineQuorumSystem< N, T >:

Collaboration graph
[legend]
List of all members.

Public Methods

 StaticByzantineQuorumSystem (ResponseTracker *aRT)
 Constructor.

virtual ~StaticByzantineQuorumSystem ()
 Destructor. This clears out any remaining message buffers.

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)
void setServer (unsigned int i, RemoteServer *server)
 Set a pointer to a RemoteServer for server slot i.

const RemoteServerserver (unsigned int i) const
 
Returns:
A pointer to the RemoteServer for server slot i.



Detailed Description

template<int N, int T>
class CODEX_Quorum::StaticByzantineQuorumSystem< N, T >

A compile-time configured Byzantine quorum system.

Template parameters that must be supplied are the number of servers in the quorum system and the number of faults tolerated.

Definition at line 39 of file StaticByzantineQuorumSystem.h.


Member Function Documentation

template<int N, int T>
bool CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::broadcastMessage const Message   msg,
ReturnVector   rets,
ResponseCallback   cb
[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 RemoteServerReturns 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.

Definition at line 158 of file StaticByzantineQuorumSystem.h.

References CODEX_Quorum::Message::buffer(), CODEX_Quorum::QuorumSystem::extractKey(), CODEX_Quorum::ResponseTracker::insert(), CODEX_Quorum::QuorumSystem::m_responseTracker, CODEX_Quorum::ResponseInfo::map(), CODEX_Quorum::ReturnVector, and CODEX_Quorum::RemoteServer::sendTo().

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

Returns:
The number of faults tolerated by this QuorumSystem.

Implements CODEX_Quorum::QuorumSystem.

Definition at line 151 of file StaticByzantineQuorumSystem.h.

Referenced by CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::poll().

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

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

Something should probably be done when testing error_set returns true.

Implements CODEX_Quorum::QuorumSystem.

Definition at line 360 of file StaticByzantineQuorumSystem.h.

References CODEX_Quorum::Message::buffer(), CODEX_Quorum::ResponseTracker::check(), CODEX_Quorum::QuorumSystem::extractKey(), CODEX_Quorum::ResponseInfo::failures(), CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::faultsTolerated(), CODEX_Quorum::RemoteServer::isset_fd(), CODEX_Quorum::Message::length(), CODEX_Quorum::QuorumSystem::m_responseTracker, CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::quorumSize(), CODEX_Quorum::RemoteServer::receiveFrom(), CODEX_Quorum::ResponseTracker::remove(), CODEX_Quorum::RemoteServer::set_fd(), and CODEX_Quorum::ResponseInfo::successes().

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

Returns:
The size of a quorum for this QuorumSystem.

Implements CODEX_Quorum::QuorumSystem.

Definition at line 143 of file StaticByzantineQuorumSystem.h.

Referenced by CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::poll().

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

Returns:
The number of servers in this QuorumSystem.

Implements CODEX_Quorum::QuorumSystem.

Definition at line 136 of file StaticByzantineQuorumSystem.h.

template<int N, int T>
void CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::setServer unsigned int    i,
RemoteServer   server
 

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.

Definition at line 491 of file StaticByzantineQuorumSystem.h.

template<int N, int T>
bool CODEX_Quorum::StaticByzantineQuorumSystem< N, T >::unicastMessage const MessageVector   msgs,
ReturnVector   rets,
ResponseCallback   cb = 0
[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 RemoteServerReturns 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.

Definition at line 249 of file StaticByzantineQuorumSystem.h.

References CODEX_Quorum::QuorumSystem::extractKey(), CODEX_Quorum::ResponseTracker::insert(), CODEX_Quorum::QuorumSystem::m_responseTracker, CODEX_Quorum::ResponseInfo::map(), CODEX_Quorum::MessageVector, CODEX_Quorum::ReturnVector, and CODEX_Quorum::RemoteServer::sendTo().


The documentation for this class was generated from the following file:
Generated on Wed Jun 2 16:33:18 2004 for COrnell Data EXchange (CODEX) by doxygen1.2.18