Meta::MPeerBroker Class Reference
Interface for distributing or obtaining objects across an AndroMeta peer-to-peer network.
More...
#include <MPeerBroker.h>
List of all members.
Detailed Description
Interface for distributing or obtaining objects across an AndroMeta peer-to-peer network.
Similar to MBroker, but instead of using TCP/IP networking, MPeerBroker uses the AndroMeta peer-to-peer system to distribute and obtain objects. This provides a flexible mechanism whereby the interface and implementation of a distributed object can be submitted as peer process.
Constructor & Destructor Documentation
| Meta::MPeerBroker::MPeerBroker |
( |
MProcTask * |
task |
) |
|
Constructor. Does not require authentication, as authentication is already handled by the peer-to-peer system.
- Parameters:
-
| task | The task to use for internal concurrent network processing. For best performance the task must be configured with an adequate number of threads. |
| virtual Meta::MPeerBroker::~MPeerBroker |
( |
|
) |
[virtual] |
Member Function Documentation
| void Meta::MPeerBroker::close |
( |
|
) |
|
| bool Meta::MPeerBroker::connect |
( |
int |
localPort, |
|
|
long |
groupId, |
|
|
const mstr & |
user, |
|
|
const mstr & |
key | |
|
) |
| | |
Explicitly connect to a peer connect to a peer process.
- Returns:
- true on success.
| bool Meta::MPeerBroker::connect |
( |
|
) |
|
Uses the MProgram arguments to attempt to connect to a peer process.
- Returns:
- true on success.
| mstr Meta::MPeerBroker::distribute |
( |
MObject * |
object, |
|
|
const mstr & |
className, |
|
|
const mstr & |
objectName = "" | |
|
) |
| | |
Distribute the specified object.
- Parameters:
-
| className | The class name of the object. |
| objectName | The broker's name of this object that client's use to obtain the object. If empty, a name will be assigned. |
- Returns:
- The name of the object as distributed, or empty string in the case of failure.
| long Meta::MPeerBroker::groupId |
( |
|
) |
const |
- Returns:
- The group id this peer broker is running as.
| bool Meta::MPeerBroker::isConnected |
( |
|
) |
const |
- Returns:
- true if connected.
| int Meta::MPeerBroker::localPort |
( |
|
) |
const |
- Returns:
- The local peer port this peer broker is connected to.
| MObject* Meta::MPeerBroker::obtain |
( |
long |
peerId, |
|
|
const mstr & |
objectName | |
|
) |
| | |
Obtain an object from a remote MPeerBroker.
- Parameters:
-
| peerId | The peer id that is hosting the remote object. |
| objectName | The name of the remote object as distributed. |
- Returns:
- On success, a pointer to the object obtained which must now be cast to the appropriate type. null is returned in the event of failure.
| virtual void Meta::MPeerBroker::onClose |
( |
|
) |
[virtual] |
| virtual bool Meta::MPeerBroker::onObtain |
( |
MObject * |
object |
) |
[virtual] |
Called on the server-side when a remote client attempts to obtain the specified object. The default behavior is to return true.
- Parameters:
-
| object | The object to be obtained. |
- Returns:
- true in order to grant access to the object.
| long Meta::MPeerBroker::peerId |
( |
|
) |
const |
- Returns:
- The peer id this peer broker is running as.
| mvec Meta::MPeerBroker::peers |
( |
|
) |
const |
- Returns:
- A vector of peer id's in the current group.
| bool Meta::MPeerBroker::release |
( |
MObject * |
object, |
|
|
bool |
disconnect = false | |
|
) |
| | [virtual] |
Called on the client-side to release the specified object. May be called internally when a disconnect occurs in which case disconnect is set to true.
- Returns:
- true on success.
Implements Meta::MBrokerBase.
| bool Meta::MPeerBroker::revoke |
( |
MObject * |
object |
) |
|
Revoke/stop serving the specified object.
| mvar& Meta::MPeerBroker::session |
( |
MObject * |
object |
) |
[virtual] |
| long Meta::MPeerBroker::submitterId |
( |
|
) |
const |
- Returns:
- The peer id that submitted this process.
| MProcTask* Meta::MPeerBroker::task |
( |
|
) |
[virtual] |
The documentation for this class was generated from the following file: