|
AndroMeta
2.0.0
|
Interface for distributing or obtaining objects across an AndroMeta peer-to-peer network. More...
#include <MPeerBroker.h>
Public Member Functions | |
| MPeerBroker (MProcTask *task) | |
| virtual | ~MPeerBroker () |
| mnode | process (MObject *object, mnode n, bool block) |
| 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 |
| long | peerId () const |
| long | submitterId () const |
| mvec | peers () const |
| void | close () |
| virtual void | onClose () |
| mstr | distribute (MObject *object, const mstr &className, const mstr &objectName="") |
| bool | revoke (MObject *object) |
| MObject * | obtain (long peerId, const mstr &objectName) |
| virtual bool | onObtain (MObject *object) |
| bool | release (MObject *object, bool disconnect=false) |
| mvar & | session (MObject *object) |
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.
| Meta::MPeerBroker::MPeerBroker | ( | MProcTask * | task | ) |
Constructor. Does not require authentication, as authentication is already handled by the peer-to-peer system.
| 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] |
Destructor.
| void Meta::MPeerBroker::close | ( | ) |
Close the connection.
| bool Meta::MPeerBroker::connect | ( | ) |
Uses the MProgram arguments to attempt to connect to a peer process.
| bool Meta::MPeerBroker::connect | ( | int | localPort, |
| long | groupId, | ||
| const mstr & | user, | ||
| const mstr & | key | ||
| ) |
Explicitly connect to a peer connect to a peer process.
| mstr Meta::MPeerBroker::distribute | ( | MObject * | object, |
| const mstr & | className, | ||
| const mstr & | objectName = "" |
||
| ) |
Distribute the specified object.
| 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. |
| long Meta::MPeerBroker::groupId | ( | ) | const |
| bool Meta::MPeerBroker::isConnected | ( | ) | const |
| int Meta::MPeerBroker::localPort | ( | ) | const |
| MObject* Meta::MPeerBroker::obtain | ( | long | peerId, |
| const mstr & | objectName | ||
| ) |
Obtain an object from a remote MPeerBroker.
| peerId | The peer id that is hosting the remote object. |
| objectName | The name of the remote object as distributed. |
| virtual void Meta::MPeerBroker::onClose | ( | ) | [virtual] |
Called upon close.
| 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.
| object | The object to be obtained. |
| long Meta::MPeerBroker::peerId | ( | ) | const |
| mvec Meta::MPeerBroker::peers | ( | ) | const |
| mnode Meta::MPeerBroker::process | ( | MObject * | object, |
| mnode | n, | ||
| bool | block | ||
| ) | [virtual] |
Do not call directly.
Implements Meta::MBrokerBase.
| 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.
Implements Meta::MBrokerBase.
| bool Meta::MPeerBroker::revoke | ( | MObject * | object | ) |
Revoke/stop serving the specified object.
| mvar& Meta::MPeerBroker::session | ( | MObject * | object | ) | [virtual] |
Called to get the session data. Should not be called directly, instead use MObject::session()
Implements Meta::MBrokerBase.
| long Meta::MPeerBroker::submitterId | ( | ) | const |
| MProcTask* Meta::MPeerBroker::task | ( | ) | [virtual] |
Implements Meta::MBrokerBase.
1.7.6.1