source: XIOS3/trunk/src/manager/ressources_manager.hpp @ 2458

Last change on this file since 2458 was 2458, checked in by ymipsl, 17 months ago

Merge XIOS_FILE_SERVICE dev branch into trunk

YM

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1#ifndef __RESSOURCES_MANAGER_HPP__
2#define __RESSOURCES_MANAGER_HPP__
3
4#include "xios_spl.hpp"
5#include "mpi.hpp"
6#include "buffer_in.hpp"
7#include "buffer_out.hpp"
8
9#include <string>
10#include <map>
11#include "window_manager.hpp"
12#include "pool_ressource.hpp"
13#include "token_manager.hpp"
14
15
16
17namespace xios
18{
19
20
21  class CRessourcesManager
22  {
23
24    const int NOTIFY_NOTHING=0 ;
25    const int NOTIFY_CREATE_POOL=1 ;
26    const int NOTIFY_FINALIZE=2 ;
27
28    public:
29   
30    CRessourcesManager(bool isXiosServer) ;
31    ~CRessourcesManager() ;
32
33    void eventLoop(void) ;
34    void createPool(const std::string& id, int size) ;
35    void createPool(void) ;
36    void finalize(void) ;
37    void finalizeSignal(void) ;
38    void sendNotification(int rank); 
39    void checkNotifications(void) ;
40    void notificationsDumpOut(CBufferOut& buffer) ;
41    void notificationsDumpIn(CBufferIn& buffer) ;
42
43    void ressourcesDumpOut(CBufferOut& buffer) ;
44    void ressourcesDumpIn(CBufferIn& buffer) ;   
45
46    int  getRessourcesSize(void) ;
47    int  getFreeRessourcesSize(void) ;
48    bool getPoolInfo(const string& poolId, int& size, int& freeSize, int& leader) ;
49    bool getPoolLeader(const string& poolId, int& leader) ;
50    bool getPoolSize(const string& poolId, int& size) ;
51    bool getPoolFreeSize(const string& poolId, int& freeSize) ;
52    bool hasPool(const string& poolId) ;
53    bool decreasePoolFreeSize(const string& poolId, int size) ;
54    void waitPoolRegistration(const string& poolId) ;
55   
56
57    void registerServerLeader(int leaderRank) ;
58    void registerRessourcesSize(int size) ;
59    void registerPoolClient(const std::string& poolId,int size,int leader) ;
60    void registerPoolServer(const std::string& poolId,int size,int leader) ;
61    CTokenManager* getTokenManager(void) {return tokenManager_ ;} 
62
63    int managerGlobalLeader_ ;
64
65    CWindowManager* winRessources_ ;
66
67    CWindowManager* winNotify_ ;
68    CTokenManager* tokenManager_ ;
69
70    const size_t maxBufferSize_=1024*1024 ;
71
72    MPI_Comm xiosComm_ ;
73
74    int notifyType_ ;
75    tuple<std::string, int> notifyCreatePool_ ;
76
77    std::map<std::string, std::tuple<int,int,int>> pools_ ;
78    int serverLeader_ ;
79    int ressourcesSize_ ;
80    int freeRessourcesSize_ ;
81
82    const double eventLoopLatency_=0; 
83    double lastEventLoop_=0. ;
84
85    friend class CWindowManager ;
86  } ;
87
88}
89#endif
Note: See TracBrowser for help on using the repository browser.