source: XIOS3/dev/XIOS_FILE_SERVICES/src/manager/ressources_manager.hpp @ 2453

Last change on this file since 2453 was 2453, checked in by ymipsl, 18 months ago

Implementation of files service on dev branch

YM

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