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
RevLine 
[1761]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 ;
[2403]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 ;
[1761]28
[2403]29    private:
30    const int NOTIFY_NOTHING=0 ;
31    const int NOTIFY_CREATE_SERVICE=1 ;
32    const int NOTIFY_CREATE_SERVICE_ONTO=2 ;
33   
[1761]34    public:
35   
36    CServicesManager(bool isXiosServer) ;
[1764]37    ~CServicesManager() ;
38   
[1761]39    bool createServices(const std::string& poolId, const std::string& serviceId, int type, int size, int nbPartition, bool wait=true) ;
[2404]40    bool createServicesOnto(const std::string& poolId, const std::string& serviceId, int type, const std::string& onServiceId, bool wait=true) ;
[2403]41   
[1761]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) ;
[2458]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) ;
[1761]49    bool hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) ;
[2458]50    void waitServiceRegistration(const std::string& poolId, const std::string& serviceId, const int& partitionId);
[2523]51    void waitServiceRegistration(const std::string& poolId, const std::string& serviceId);
[1761]52    void servicesDumpOut(CBufferOut& buffer) ;
53    void servicesDumpIn(CBufferIn& buffer) ;
[2458]54    int  getRessourcesSize(const std::string& poolId) ;
55    int  getFreeRessourcesSize(const std::string& poolId) ;
[1761]56
[2403]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) ;
[2404]62    void createServicesOntoNotify(int rank, const string& serviceId, int type, const string& OnServiceId) ;
[2403]63    void sendNotification(int rank) ;
64    void checkNotifications(void) ;
65    void notificationsDumpOut(CBufferOut& buffer) ;
66    void notificationsDumpIn(CBufferIn& buffer) ;
67
68
[1761]69    private :
70   
71    CWindowManager* winServices_ ;
72    CWindowManager* winNotify_ ;
73    const size_t maxBufferSize_=1024*1024 ;
74
75    MPI_Comm xiosComm_ ;
76
[2523]77    int notifyType_ = NOTIFY_NOTHING ;
[2403]78    tuple<std::string, int, int, int> notifyCreateService_ ;
[2404]79    tuple<std::string, int, std::string> notifyCreateServiceOnto_ ;
[2403]80   
[1761]81    std::map<tuple<std::string, std::string, int>, std::tuple<int, int, int, int> > services_ ;
82
83    int managerGlobalLeader_ ;
[2246]84
[2260]85    const double eventLoopLatency_=0; 
[2246]86    double lastEventLoop_=0. ;
[1761]87   
88    friend class CWindowManager ;
89  } ;
90
91
92}
93
94
95
[2335]96#endif
Note: See TracBrowser for help on using the repository browser.