65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
#ifndef RESSOURCEVALUEDISTRIBUTOR_H
|
|
#define RESSOURCEVALUEDISTRIBUTOR_H
|
|
|
|
#include "common/MoversightService.h"
|
|
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
class Dispatcher;
|
|
class ResourceValueMetric;
|
|
class MemberRegister;
|
|
class ResourceValueProfile;
|
|
class MulticastMessage;
|
|
class Cluster;
|
|
|
|
/**
|
|
* @brief Class distribute the resource value of the local peer
|
|
* @class ResourceValueDistributor
|
|
* @author Felix Stubbe
|
|
* @ingroup Moversight
|
|
*/
|
|
class ResourceValueDistributor : public MoversightService {
|
|
public:
|
|
|
|
ResourceValueDistributor(Dispatcher & d);
|
|
|
|
virtual ~ResourceValueDistributor();
|
|
|
|
ResourceValueDistributor(const ResourceValueDistributor& other);
|
|
|
|
ResourceValueDistributor& operator=(const ResourceValueDistributor& other);
|
|
|
|
void initialise();
|
|
|
|
void finalise();
|
|
|
|
void setAndSendResourceValue(const PeerResources & peerResources);
|
|
|
|
const PeerResources & getCurrentResourceValue();
|
|
|
|
void estimateAllPeerResources(MulticastMessage * msg);
|
|
|
|
static PeerResources estimatePeerResourcesByMessagesStatic(const Peer & peer, const MulticastMessage * msg, const PeerResources & currentResources, MemberRegister & memberReg);
|
|
|
|
private:
|
|
void sendResourceValueUpdate(const PeerResources & peerResources);
|
|
|
|
void estimateClusterPeerResources(Cluster & cluster, MulticastMessage * msg);
|
|
|
|
void estimatePeerListPeerResources(PeerList & peerList, MulticastMessage * msg);
|
|
|
|
void estimatePeerPeerResources(Peer & peer, MulticastMessage * msg);
|
|
|
|
PeerResources resources;
|
|
|
|
ResourceValueMetric * metric;
|
|
|
|
ResourceValueProfile * rvp;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif // RESSOURCEVALUEDISTRIBUTOR_H
|