The central actor in the AndroMeta peer-to-peer system. More...
#include <MPeer.h>
Public Member Functions | |
| MPeer (MProcTask *task, MAuth *auth, const mstr &scratchDir, size_t maxProcesses=0) | |
| MPeer (MProcTask *task) | |
| virtual | ~MPeer () |
| MProcTask * | task () |
| bool | connect (mstr &hubHost, int hubPort, int localPort, const mstr &user, const mstr &password, bool requireRouter=false, bool isRouter=false) |
| bool | submitProcess (const MPackage &package, size_t minHosts=1, size_t maxHosts=1000, double minUptime=100, double minCPU=0, double minNetwork=0) |
| bool | submitProcess (MPeerBroker *broker, const MPackage &package, size_t minHosts=1, size_t maxHosts=1000, double minUptime=100, double minCPU=0, double minNetwork=0) |
| bool | submitProcess (MPeerProc *peerProc, const MPackage &package, size_t minHosts=1, size_t maxHosts=1000, double minUptime=100, double minCPU=0, double minNetwork=0) |
| bool | attach (int localPort, const mstr &user, const mstr &password) |
| size_t | maxProcesses () const |
| void | setMaxProcesses (size_t maxProcesses) |
| const mstr & | scratchDir () const |
| void | setScratchDir (const mstr &scratchDir) |
| int | localPort () const |
| virtual void | onHubDisconnect () |
| virtual void | onUpdate () |
| mvar | peerInfo () const |
| mvar | groupInfo () const |
The central actor in the AndroMeta peer-to-peer system.
In the AndroMeta peer-to-peer system, peers connect to a hub and periodically receive updates about other connected peers. Peers submit jobs to this "cluster" and depending on how they are configured, may also run processes from other peers. See src/network for an example of how MPeer is used.
| Meta::MPeer::MPeer | ( | MProcTask * | task, | |
| MAuth * | auth, | |||
| const mstr & | scratchDir, | |||
| size_t | maxProcesses = 0 | |||
| ) |
Constructor.
| task | The task to use for concurrent/communications processing. | |
| auth | The local authenticator. | |
| scratchDir | The scratch directory for submitted processes. | |
| maxProcesses | The maximum number of simultaneous processes this peer shall be allowed to run. |
| Meta::MPeer::MPeer | ( | MProcTask * | task | ) |
This constructor is used when attaching to another peer.
| virtual Meta::MPeer::~MPeer | ( | ) | [virtual] |
Destructor.
Attach to a local peer, most often for purposes of submitting a process.
| bool Meta::MPeer::connect | ( | mstr & | hubHost, | |
| int | hubPort, | |||
| int | localPort, | |||
| const mstr & | user, | |||
| const mstr & | password, | |||
| bool | requireRouter = false, |
|||
| bool | isRouter = false | |||
| ) |
Connect the peer to a hub.
| hubHost | The hub host/IP address. | |
| hubPort | The hub port. | |
| localPort | The local port this peer listens on, for connections from other peers. | |
| user | User to authenticate on hub with. | |
| password | Password to authenticate on hub with. | |
| requireRouter | true if this peer should use a router for other peers to connect to it. | |
| isRouter | true if this peer shall act as a router. |
| mvar Meta::MPeer::groupInfo | ( | ) | const |
Get info about all running groups/processes this peer knows about.
| int Meta::MPeer::localPort | ( | ) | const |
Get the local port that this peer listens on.
| size_t Meta::MPeer::maxProcesses | ( | ) | const |
Get the maximum number of processes this peer is allowed to run.
| virtual void Meta::MPeer::onHubDisconnect | ( | ) | [virtual] |
Called when this peer disconnects from a hub.
| virtual void Meta::MPeer::onUpdate | ( | ) | [virtual] |
Called when this peer gets an update from the hub.
| mvar Meta::MPeer::peerInfo | ( | ) | const |
Get info about all connected peers this peer knows about.
| const mstr& Meta::MPeer::scratchDir | ( | ) | const |
Get the scratch directory for submitted processes.
| void Meta::MPeer::setMaxProcesses | ( | size_t | maxProcesses | ) |
Set the maximum number of processes this peer is allowed to run.
| void Meta::MPeer::setScratchDir | ( | const mstr & | scratchDir | ) |
Set the scratch directory for submitted processes.
| bool Meta::MPeer::submitProcess | ( | MPeerProc * | peerProc, | |
| const MPackage & | package, | |||
| size_t | minHosts = 1, |
|||
| size_t | maxHosts = 1000, |
|||
| double | minUptime = 100, |
|||
| double | minCPU = 0, |
|||
| double | minNetwork = 0 | |||
| ) |
Submit a process, binding to an existing MPeerProc.
| bool Meta::MPeer::submitProcess | ( | MPeerBroker * | broker, | |
| const MPackage & | package, | |||
| size_t | minHosts = 1, |
|||
| size_t | maxHosts = 1000, |
|||
| double | minUptime = 100, |
|||
| double | minCPU = 0, |
|||
| double | minNetwork = 0 | |||
| ) |
Submit a process through a peer broker.
| bool Meta::MPeer::submitProcess | ( | const MPackage & | package, | |
| size_t | minHosts = 1, |
|||
| size_t | maxHosts = 1000, |
|||
| double | minUptime = 100, |
|||
| double | minCPU = 0, |
|||
| double | minNetwork = 0 | |||
| ) |
Submit a process by package.
| minHosts | The minimum number of hosts required to run. | |
| maxHosts | The maxmimum number of hosts to run on. | |
| minUptime | Require hosts to have been up for minUpTime. | |
| minCPU | Require hosts to have minCPU benchmark. | |
| minNetwork | Require hosts to have minNetwork update time. |
| MProcTask* Meta::MPeer::task | ( | ) |
1.6.1