|
AndroMeta
2.0.0
|
Coordinates peers in the AndroMeta peer-to-peer system. More...
#include <MHub.h>
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 |
| MProcTask * | task () |
| MAuth * | auth () |
| const MAuth * | auth () 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) |
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.
| Meta::MHub::MHub | ( | MProcTask * | task, |
| MAuth * | auth | ||
| ) |
Constructor.
| task | The task to be used for communication/concurrency processing. |
| auth | The authenticator. |
| Meta::MHub::MHub | ( | MProcTask * | task, |
| MAuth * | auth, | ||
| const mvar & | v, | ||
| RestoreOpt | opt | ||
| ) |
Restore constructor.
| virtual Meta::MHub::~MHub | ( | ) | [virtual] |
Destructor.
| MAuth* Meta::MHub::auth | ( | ) |
| const MAuth* Meta::MHub::auth | ( | ) | const |
| mvar Meta::MHub::groupInfo | ( | long | groupId | ) | const |
| bool Meta::MHub::listen | ( | int | port | ) |
Begin listening on the requested port.
| long Meta::MHub::maxPackageSize | ( | ) | const |
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.
| virtual bool Meta::MHub::onPeerConnect | ( | const mvar & | peerInfo | ) | [virtual] |
Called upon peer connect after the peer has authenticated.
| virtual void Meta::MHub::onPeerDisconnect | ( | const mvar & | peerInfo | ) | [virtual] |
Called when a peer disconnects.
| mvar Meta::MHub::peerInfo | ( | long | peerId | ) | const |
| bool Meta::MHub::requireSubmit | ( | ) | const |
| 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.
1.7.6.1