source: XIOS3/trunk/src/manager/services_manager.hpp

Last change on this file was 2523, checked in by ymipsl, 12 months ago

Adaptation to new hyper event scheduler.
YM

  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#ifndef __SERVICES_MANAGER_HPP__
2#define __SERVICES_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
13
14
15namespace xios
16{
17  class CServicesManager
18  {
19
20    public: 
21    static const int CLIENT=0 ;
22    static const int GATHERER=1 ;
23    static const int WRITER=2 ;
24    static const int READER=3 ;
25    static const int IO_SERVER=4 ;
26    static const int OUT_SERVER=5 ;
27    static const int ALL_SERVICES=6 ;
28
29    private:
30    const int NOTIFY_NOTHING=0 ;
31    const int NOTIFY_CREATE_SERVICE=1 ;
32    const int NOTIFY_CREATE_SERVICE_ONTO=2 ;
33   
34    public:
35   
36    CServicesManager(bool isXiosServer) ;
37    ~CServicesManager() ;
38   
39    bool createServices(const std::string& poolId, const std::string& serviceId, int type, int size, int nbPartition, bool wait=true) ;
40    bool createServicesOnto(const std::string& poolId, const std::string& serviceId, int type, const std::string& onServiceId, bool wait=true) ;
41   
42    void eventLoop(void) ;
43   
44    void registerService(const std::string& poolId, const std::string& serviceId, const int& partitionId, int type, int size, int nbPartitions, int leader) ;
45    bool getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, int& size, int& nbPartition, int& leader, bool wait=false) ;
46    bool getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader, bool wait=false) ;
47    bool getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, bool wait=false) ;
48    bool getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartition, bool wait=false) ;
49    bool hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) ;
50    void waitServiceRegistration(const std::string& poolId, const std::string& serviceId, const int& partitionId);
51    void waitServiceRegistration(const std::string& poolId, const std::string& serviceId);
52    void servicesDumpOut(CBufferOut& buffer) ;
53    void servicesDumpIn(CBufferIn& buffer) ;
54    int  getRessourcesSize(const std::string& poolId) ;
55    int  getFreeRessourcesSize(const std::string& poolId) ;
56
57    private:
58
59    void createService(void) ;
60    void createServiceOnto(void) ;   
61    void createServicesNotify(int rank, const string& serviceId, int type, int size, int nbPartitions) ;
62    void createServicesOntoNotify(int rank, const string& serviceId, int type, const string& OnServiceId) ;
63    void sendNotification(int rank) ;
64    void checkNotifications(void) ;
65    void notificationsDumpOut(CBufferOut& buffer) ;
66    void notificationsDumpIn(CBufferIn& buffer) ;
67
68
69    private :
70   
71    CWindowManager* winServices_ ;
72    CWindowManager* winNotify_ ;
73    const size_t maxBufferSize_=1024*1024 ;
74
75    MPI_Comm xiosComm_ ;
76
77    int notifyType_ = NOTIFY_NOTHING ;
78    tuple<std::string, int, int, int> notifyCreateService_ ;
79    tuple<std::string, int, std::string> notifyCreateServiceOnto_ ;
80   
81    std::map<tuple<std::string, std::string, int>, std::tuple<int, int, int, int> > services_ ;
82
83    int managerGlobalLeader_ ;
84
85    const double eventLoopLatency_=0; 
86    double lastEventLoop_=0. ;
87   
88    friend class CWindowManager ;
89  } ;
90
91
92}
93
94
95
96#endif
Note: See TracBrowser for help on using the repository browser.