source: XIOS/dev/dev_ym/XIOS_SERVICES/src/manager/services_manager.hpp @ 1761

Last change on this file since 1761 was 1761, checked in by ymipsl, 5 years ago

implementing first guess for service functionnalities.

YM

  • Property svn:executable set to *
File size: 2.2 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 IO_SERVER=2 ;
24    static const int OUT_SERVER=3 ;
25
26    public:
27   
28    CServicesManager(bool isXiosServer) ;
29    bool createServices(const std::string& poolId, const std::string& serviceId, int type, int size, int nbPartition, bool wait=true) ;
30    void createServicesNotify(int rank, const string& serviceId, int type, int size, int nbPartitions) ;
31    void checkCreateServicesNotification(void) ;
32    void eventLoop(void) ;
33    void notificationsDumpOut(CBufferOut& buffer) ;
34    void notificationsDumpIn(CBufferIn& buffer) ;
35   
36    void registerService(const std::string& poolId, const std::string& serviceId, const int& partitionId, int type, int size, int nbPartitions, int leader) ;
37    bool getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, int& size, int& nbPartition, int& leader) ;
38    bool getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader) ;
39    bool getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type) ;
40    bool getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartition) ;
41    bool hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) ;
42    void servicesDumpOut(CBufferOut& buffer) ;
43    void servicesDumpIn(CBufferIn& buffer) ;
44   
45
46    private :
47   
48    CWindowManager* winServices_ ;
49    CWindowManager* winNotify_ ;
50    const size_t maxBufferSize_=1024*1024 ;
51
52    MPI_Comm xiosComm_ ;
53
54    std::list<std::tuple<std::string, int, int, int> > notifications_;
55   
56    std::map<tuple<std::string, std::string, int>, std::tuple<int, int, int, int> > services_ ;
57
58    int managerGlobalLeader_ ;
59   
60    friend class CWindowManager ;
61  } ;
62
63
64}
65
66
67
68#endif
Note: See TracBrowser for help on using the repository browser.