AndroMeta  2.0.0
Public Member Functions
Meta::MHub Class Reference

Coordinates peers in the AndroMeta peer-to-peer system. More...

#include <MHub.h>

Inheritance diagram for Meta::MHub:
Meta::MObjectBase

List of all members.

Public Member Functions

 MHub (MProcTask *task, MAuth *auth)
 MHub (MProcTask *task, MAuth *auth, const mvar &v, RestoreOpt opt)
virtual ~MHub ()
void store (mvar &v) const
MProcTasktask ()
MAuthauth ()
const MAuthauth () const
bool listen (int port)
bool requireSubmit () const
void setRequireSubmit (bool flag)
long maxPackageSize () const
void setMaxPackageSize (long size)
size_t maxPeers () const
void setMaxPeers (size_t maxPeers)
mvar peerInfo (long peerId) const
mvar groupInfo (long groupId) const
virtual bool onPeerConnect (const mvar &peerInfo)
virtual void onPeerDisconnect (const mvar &peerInfo)
virtual bool onGroupSubmit (const mvar &groupInfo)
virtual void onGroupEnd (const mvar &groupInfo)

Detailed Description

Coordinates peers in the AndroMeta peer-to-peer system.

The MHub provides a meeting place for peers in the AndroMeta peer-to-peer system. Peers connect to a hub in order to receive updates about other connected peers, however the hub is not directly used for messaging. For application messaging, peers must either be directly reachable through TCP/IP or there must exist a centralized peer acting as a "router" which relays messages among peers, see MPeer.

The hub is responsible for handling process submissions. Various parameters may be configured which determine the requirements of connected peers and handle various other settings. The hub is fully storeable and restoreable. See src/network for an example of how MHub is used.


Constructor & Destructor Documentation

Meta::MHub::MHub ( MProcTask task,
MAuth auth 
)

Constructor.

Parameters:
taskThe task to be used for communication/concurrency processing.
authThe authenticator.
Meta::MHub::MHub ( MProcTask task,
MAuth auth,
const mvar v,
RestoreOpt  opt 
)

Restore constructor.

virtual Meta::MHub::~MHub ( ) [virtual]

Destructor.


Member Function Documentation

Returns:
The MAuth that this hub was constructed with.
const MAuth* Meta::MHub::auth ( ) const
Returns:
The MAuth that this hub was constructed with.
mvar Meta::MHub::groupInfo ( long  groupId) const
Returns:
Information about a running group.
bool Meta::MHub::listen ( int  port)

Begin listening on the requested port.

Returns:
true on success.

Get the maximum size of peer submitted packages.

size_t Meta::MHub::maxPeers ( ) const

Get the maximum number of connected peers this hub allows.

virtual void Meta::MHub::onGroupEnd ( const mvar groupInfo) [virtual]

Called when a group ends.

virtual bool Meta::MHub::onGroupSubmit ( const mvar groupInfo) [virtual]

Called when a process/group is submitted.

Returns:
true to allow submission to proceed.
virtual bool Meta::MHub::onPeerConnect ( const mvar peerInfo) [virtual]

Called upon peer connect after the peer has authenticated.

Returns:
true to allow this peer to connect.
virtual void Meta::MHub::onPeerDisconnect ( const mvar peerInfo) [virtual]

Called when a peer disconnects.

mvar Meta::MHub::peerInfo ( long  peerId) const
Returns:
Information about a connected peer.
bool Meta::MHub::requireSubmit ( ) const
Returns:
true if this hub requires all connected peers to allow process submissions.
void Meta::MHub::setMaxPackageSize ( long  size)

Set the maximumum size of peer submitted packages.

void Meta::MHub::setMaxPeers ( size_t  maxPeers)

Set the maximum number of connected peers this hub allows.

void Meta::MHub::setRequireSubmit ( bool  flag)

Set whether or not this hub requires all connected peers to allow process submissions.

void Meta::MHub::store ( mvar v) const [virtual]

Store hub to v.

Reimplemented from Meta::MObjectBase.

Returns:
The task that this hub was constructed with.

The documentation for this class was generated from the following file: