A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DistributionManagerClient.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * *
3  * Copyright 2018 Rice University *
4  * *
5  * Licensed under the Apache License, Version 2.0 (the "License"); *
6  * you may not use this file except in compliance with the License. *
7  * You may obtain a copy of the License at *
8  * *
9  * http://www.apache.org/licenses/LICENSE-2.0 *
10  * *
11  * Unless required by applicable law or agreed to in writing, software *
12  * distributed under the License is distributed on an "AS IS" BASIS, *
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14  * See the License for the specific language governing permissions and *
15  * limitations under the License. *
16  * *
17  *****************************************************************************/
18 
19 #ifndef Distribution_Manager_CLIENT_H
20 #define Distribution_Manager_CLIENT_H
21 
22 #include "ServerFunctionality.h"
23 #include "PDBLogger.h"
24 #include "PDBServer.h"
25 #include "PDBString.h"
26 
27 
28 #include "NodeInfo.h"
29 #include "Ack.h"
30 #include "QueryPermit.h"
31 #include "QueryPermitResponse.h"
32 #include "QueryDone.h"
33 #include "PlaceOfQueryPlanner.h"
34 #include "PDBVector.h"
35 #include "QueryBase.h"
36 #include "ListOfNodes.h"
37 
38 namespace pdb {
39 
41 typedef shared_ptr<DistributionManagerClient> DistributionManagerClientPtr;
42 
44 
45 public:
47 
48  DistributionManagerClient(pdb::String hostnameIn, int portIn, PDBLoggerPtr logger);
49 
51 
52  // function to register event handlers associated with this server functionality
53  virtual void registerHandlers(PDBServer& forMe) override;
54 
55 
56  // TODO: Not sure if we need a shutDown method for the distribution manager.
57  // // shuts down the server that we are connected to... returns true on success
58  // bool shutDownServer (std :: string &errMsg);
59 
60  // send the HeartBeat info to the server.
61  void sendHeartBeat(string& managerHostName, int managerNodePort, bool& wasError, string& errMsg);
62 
63  // send the HeartBeat info to the server.
64  Handle<ListOfNodes> getCurrentNodes(string& managerHostName,
65  int managerNodePort,
66  bool& wasError,
67  string& errMsg);
68 
69  // send a request for running a query
71  int managerNodePort,
72  pdb::Handle<QueryPermit> m_queryPermit,
73  bool& wasError,
74  string& errMsg);
75 
76  // informs the server that running of a specific query is done
77  Handle<Ack> sendQueryDone(string& hostName,
78  int managerNodePort,
79  Handle<QueryDone> m_queryDone,
80  bool& wasError,
81  string& errMsg);
82 
83  // sends the place of query planner node to the user-client
84  Handle<Ack> sendGetPlaceOfQueryPlanner(string& hostName,
85  int managerNodePort,
86  Handle<PlaceOfQueryPlanner> m_PlaceOfQueryPlanner,
87  bool& wasError,
88  string& errMsg);
89 
90  // Executes a vector of queries on the cluster on a specific set of cluster nodes.
91  // Handle <Vector <Handle <Ack>>> executeQueriesOnCluster(Handle <Vector<Handle <QueryBase>>>
92  //queries, Handle <Vector <Handle <String>>> hostNames, Handle <Vector <Handle <int>>>
93  //hostPorts);
94 
95  // Executes a single queries on a single remote node.
96  // Handle<Ack> executeQueryOnSingleNode(Handle <Vector<Handle <QueryBase>>> queries, Handle
97  //<String> hostNames, Handle <int> hostPorts, string& errMsg);
98 
99  // get the logger
101  return this->logger;
102  }
103 
104 private:
106  int port;
108 };
109 }
110 
111 #endif
virtual void registerHandlers(PDBServer &forMe) override
void sendHeartBeat(string &managerHostName, int managerNodePort, bool &wasError, string &errMsg)
Handle< Ack > sendGetPlaceOfQueryPlanner(string &hostName, int managerNodePort, Handle< PlaceOfQueryPlanner > m_PlaceOfQueryPlanner, bool &wasError, string &errMsg)
shared_ptr< DistributionManagerClient > DistributionManagerClientPtr
std::shared_ptr< PDBLogger > PDBLoggerPtr
Definition: PDBLogger.h:40
Handle< QueryPermitResponse > sendQueryPermitt(string &hostName, int managerNodePort, pdb::Handle< QueryPermit > m_queryPermit, bool &wasError, string &errMsg)
Handle< Ack > sendQueryDone(string &hostName, int managerNodePort, Handle< QueryDone > m_queryDone, bool &wasError, string &errMsg)
Handle< ListOfNodes > getCurrentNodes(string &managerHostName, int managerNodePort, bool &wasError, string &errMsg)