Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages

LrmImpl.hpp

Go to the documentation of this file.
00001 #ifndef LRMIMPL_HPP
00002 #define LRMIMPL_HPP
00003 
00004 #include <string>
00005 #include <map>
00006 
00007 #include "utils/c++/GuardedVariable.hpp"
00008 #include "AppInfoHolder.hpp"
00009 
00010 using std::string;
00011 using std::map;
00012 
00013 
00014 class LocStaticInfo;
00015 class LocDynamicInfo;
00016 class ExecutionSpecs;
00017 class OfferSpecs;
00018 class Config;
00019 
00020 #include <iostream> //FIXME: Remove
00021 
00022 using std::cerr;
00023 using std::endl;
00024 
00047 class LrmImpl{
00048 
00049  private:
00050 
00051   string grmIor;                    
00052   string appReposIor;               
00053   GuardedVariable<long> sampleInterval;    
00057   GuardedVariable<long> keepAliveInterval; 
00061   float threshold;                  
00067   string orbPath;                   
00070   string appReposIdlPath;           
00071   string resourceManagementIdlPath; 
00076   GuardedVariable<int> appId;       
00084   struct lua_State * clientSideState; 
00086   map<string, AppInfoHolder> launchedAppsInfo;
00087     map<string, AppInfoHolder> finishedAppsInfo;
00088 
00089 
00090 
00091   pthread_mutex_t launchedAppsInfoLock;
00092   pthread_mutex_t finishedAppsInfoLock;
00093 
00094 
00095   
00103   void copyFile(const string & srcPath, const string & dstPath);
00104 
00105   static void * notifyStatus(void * ptr);
00106 
00107   LrmImpl(const Config & config);
00108 
00109   static LrmImpl * singleInstance_;
00110 
00111   void notifyStatus();
00112 
00113   static void * notifyStatusWrapper(void * ptr);
00114 
00115   //TODO: COMMENT ME
00116   void cleanup();
00117 
00118  public:
00119 
00120    //TODO: COMMENT ME
00121    static LrmImpl & init(const Config & config);
00122 
00127   void updateLoop();
00128 
00129 
00138   void setSampleInterval(long seconds){ sampleInterval.set(seconds); }
00139 
00153   void setKeepAliveInterval(long seconds) { keepAliveInterval.set(seconds); }
00154 
00155 
00161    void remoteExecutionRequest(ExecutionSpecs execSpecs);
00162 
00163   //TODO: COMMENT ME
00164   AppInfoHolder appInfo(const string & appId){
00165     pthread_mutex_lock(&finishedAppsInfoLock);
00166       AppInfoHolder appInfo = finishedAppsInfo[appId];
00167     pthread_mutex_unlock(&finishedAppsInfoLock);
00168      return appInfo;
00169   }
00170 
00171   //TODO: COMMENT ME
00172   void removeAppInfo(const string & appId){
00173     pthread_mutex_lock(&finishedAppsInfoLock);
00174       if(! (finishedAppsInfo.erase(appId) == 1))
00175         assert(false);
00176     pthread_mutex_unlock(&finishedAppsInfoLock);
00177   }
00178 
00179   //TODO: COMMENT ME
00180   void kill(const string & appId);
00181 
00182 
00183 };
00184 #endif//LRMIMPL_HPP
00185 

Generated on Mon Sep 6 16:12:48 2004 by doxygen 1.3.3