AndroMeta  2.0.0
Public Member Functions
Meta::MPeer Class Reference

The central actor in the AndroMeta peer-to-peer system. More...

#include <MPeer.h>

List of all members.

Public Member Functions

 MPeer (MProcTask *task, MAuth *auth, const mstr &scratchDir, size_t maxProcesses=0)
 MPeer (MProcTask *task)
virtual ~MPeer ()
MProcTasktask ()
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 mstrscratchDir () const
void setScratchDir (const mstr &scratchDir)
int localPort () const
virtual void onHubDisconnect ()
virtual void onUpdate ()
mvar peerInfo () const
mvar groupInfo () const

Detailed Description

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.


Constructor & Destructor Documentation

Meta::MPeer::MPeer ( MProcTask task,
MAuth auth,
const mstr scratchDir,
size_t  maxProcesses = 0 
)

Constructor.

Parameters:
taskThe task to use for concurrent/communications processing.
authThe local authenticator.
scratchDirThe scratch directory for submitted processes.
maxProcessesThe maximum number of simultaneous processes this peer shall be allowed to run.

This constructor is used when attaching to another peer.

virtual Meta::MPeer::~MPeer ( ) [virtual]

Destructor.


Member Function Documentation

bool Meta::MPeer::attach ( int  localPort,
const mstr user,
const mstr password 
)

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.

Parameters:
hubHostThe hub host/IP address.
hubPortThe hub port.
localPortThe local port this peer listens on, for connections from other peers.
userUser to authenticate on hub with.
passwordPassword to authenticate on hub with.
requireRoutertrue if this peer should use a router for other peers to connect to it.
isRoutertrue if this peer shall act as a router.
Returns:
true on success.

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.

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 ( 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.

Parameters:
minHostsThe minimum number of hosts required to run.
maxHostsThe maxmimum number of hosts to run on.
minUptimeRequire hosts to have been up for minUpTime.
minCPURequire hosts to have minCPU benchmark.
minNetworkRequire hosts to have minNetwork update time.
Returns:
true on success.
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 ( 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.

Returns:
The task the peer was constructed with.

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