Meta::MPeerProc Class Reference

AndroMeta peer-to-peer application-level interface. More...

#include <MPeerProc.h>

List of all members.

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
MProcTasktask ()
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

Detailed Description

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.


Constructor & Destructor Documentation

Meta::MPeerProc::MPeerProc ( MProcTask task  ) 

Constructor.

Parameters:
task Task to be used for concurrency/communications processing.
virtual Meta::MPeerProc::~MPeerProc (  )  [virtual]

Destructor.


Member Function Documentation

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.

Parameters:
block If false, do not wait for message to be delivered.
Returns:
true on success, fails if connection becomes closed while the operation is in progress.
void Meta::MPeerProc::close (  ) 

Shutdown the peer process and close the connection to peer.

bool Meta::MPeerProc::connect ( int  localPort,
long  groupId,
const mstr user,
const mstr key 
)

Explicitly connect to a peer.

Returns:
true on success.
bool Meta::MPeerProc::connect (  ) 

Uses the MProgram arguments to attempt to connect to a peer.

Returns:
true on success.
long Meta::MPeerProc::groupId (  )  const
Returns:
The group id of this peer process.
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
Returns:
true if connected.
int Meta::MPeerProc::localPort (  )  const
Returns:
The local port the peer is running on.
virtual void Meta::MPeerProc::onClose ( long  peerId  )  [virtual]

Reimplement to provide applications-specific behavior when a peer exits the group.

virtual void Meta::MPeerProc::onClose (  )  [virtual]

Reimplement to provide applications-specific behavior on close.

long Meta::MPeerProc::peerId (  )  const
Returns:
The peer id this peer process is running as.
mvec Meta::MPeerProc::peers (  )  const
Returns:
A vector of peer id's in the running group.
long Meta::MPeerProc::submitterId (  )  const
Returns:
The peer id that submitted this process.
MProcTask* Meta::MPeerProc::task (  ) 
Returns:
The MProcTask that the broker was constructed with.
bool Meta::MPeerProc::unicast ( long  peerId,
const mvar msg,
const mvar header = undef,
bool  block = false 
)

Send a message to a single peer.

Parameters:
block If false, do not wait for message to be delivered.
Returns:
true on success, fails if connection becomes closed while the operation is in progress.

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

Generated on Wed Mar 24 16:22:43 2010 for AndroMeta by  doxygen 1.6.1