|
AndroMeta
2.0.0
|
AndroMeta peer-to-peer application-level interface. More...
#include <MPeerProc.h>
Public Member Functions | |
| MPeerProc (MProcTask *task) | |
| virtual | ~MPeerProc () |
| bool | connect () |
| bool | connect (int localPort, long groupId, const mstr &user, const mstr &key) |
| bool | isConnected () const |
| MProcTask * | task () |
| int | localPort () const |
| long | groupId () const |
| bool | unicast (long peerId, const mvar &msg, const mvar &header=undef, bool block=false) |
| bool | broadcast (const mvar &msg, const mvar &header=undef, bool block=false) |
| long | peerId () const |
| long | submitterId () const |
| mvec | peers () const |
| void | barrier () |
| void | close () |
| virtual void | onClose () |
| virtual void | onClose (long peerId) |
| virtual void | handleMessage (mvar &msg, mvar &header)=0 |
AndroMeta peer-to-peer application-level interface.
Provides an interface for an application to run through the AndroMeta peer-to-peer system, supporting unicast, broadcast, barrier, and various methods for querying the peer.
| Meta::MPeerProc::MPeerProc | ( | MProcTask * | task | ) |
Constructor.
| task | Task to be used for concurrency/communications processing. |
| virtual Meta::MPeerProc::~MPeerProc | ( | ) | [virtual] |
Destructor.
| void Meta::MPeerProc::barrier | ( | ) |
Barrier sycnhronization -- block until all peers have entered the barrier.
| bool Meta::MPeerProc::broadcast | ( | const mvar & | msg, |
| const mvar & | header = undef, |
||
| bool | block = false |
||
| ) |
Broadcast a message to all peers in the running group.
| block | If false, do not wait for message to be delivered. |
| void Meta::MPeerProc::close | ( | ) |
Shutdown the peer process and close the connection to peer.
| bool Meta::MPeerProc::connect | ( | ) |
Uses the MProgram arguments to attempt to connect to a peer.
| bool Meta::MPeerProc::connect | ( | int | localPort, |
| long | groupId, | ||
| const mstr & | user, | ||
| const mstr & | key | ||
| ) |
Explicitly connect to a peer.
| long Meta::MPeerProc::groupId | ( | ) | const |
| virtual void Meta::MPeerProc::handleMessage | ( | mvar & | msg, |
| mvar & | header | ||
| ) | [pure virtual] |
Reimplement to provide application-specific handling when a message is received.
| bool Meta::MPeerProc::isConnected | ( | ) | const |
| int Meta::MPeerProc::localPort | ( | ) | const |
| virtual void Meta::MPeerProc::onClose | ( | ) | [virtual] |
Reimplement to provide applications-specific behavior on close.
| virtual void Meta::MPeerProc::onClose | ( | long | peerId | ) | [virtual] |
Reimplement to provide applications-specific behavior when a peer exits the group.
| long Meta::MPeerProc::peerId | ( | ) | const |
| mvec Meta::MPeerProc::peers | ( | ) | const |
| long Meta::MPeerProc::submitterId | ( | ) | const |
| bool Meta::MPeerProc::unicast | ( | long | peerId, |
| const mvar & | msg, | ||
| const mvar & | header = undef, |
||
| bool | block = false |
||
| ) |
Send a message to a single peer.
| block | If false, do not wait for message to be delivered. |
1.7.6.1