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
NodeDispatcherData.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 // Created by Joseph Hwang on 9/13/16.
20 //
21 
22 #ifndef OBJECTQUERYMODEL_NODEDISPATCHERDATA_H
23 #define OBJECTQUERYMODEL_NODEDISPATCHERDATA_H
24 
25 #include "Object.h"
26 #include "PDBString.h"
27 #include "PDBVector.h"
28 #include "DataTypes.h"
29 //#include "SetInfo.h"
30 
31 #include <string>
32 
33 // PRELOAD %NodeDispatcherData%
34 
35 namespace pdb {
36 
37 class NodeDispatcherData : public Object {
38 
39 public:
41 
44 
46  this->nodeId = nodeId;
47  this->port = port;
48  this->address = address;
49  this->totalBytesSent = 0;
50  this->totalBytesStored = 0;
51  }
52 
54  return this->nodeId;
55  }
56 
57  int getPort() const {
58  return this->port;
59  }
60 
61  String getAddress() const {
62  return this->address;
63  }
64 
65  size_t getBytesSentToSet() const {
66  return 0;
67  }
68 
69  /*
70  void addSet(std::string set, std::string database, long typeId) {
71  sets.push_back(pdb::makeObject<pdb::SetInfo> (set, database, typeId));
72  bytesSent.push_back(0);
73  }
74  */
75 
76  bool operator==(const NodeDispatcherData& other) {
77  return this->port == other.getPort() && this->address == other.getAddress();
78  }
79 
80  std::string toString() {
81  return std::to_string(this->port) + ":" + static_cast<std::string>(this->address);
82  }
83 
84 private:
86  int port;
88 
89  // TODO: Replace this with map when possible. Provides a mapping between a set and the number of
90  // bytes sent to it.
91  // Vector<Handle<SetInfo>> sets;
92 
93  // JOSEPH: These bottom values will only be available to the dispatcher
96 
99 
100  // TODO: Add database and set information
101 };
102 }
103 
104 
105 #endif // OBJECTQUERYMODEL_NODEDISPATCHERDATA_H
#define ENABLE_DEEP_COPY
Definition: DeepCopy.h:52
Vector< size_t > bytesStored
bool operator==(const NodeDispatcherData &other)
unsigned int NodeID
Definition: DataTypes.h:27
NodeDispatcherData(NodeID nodeId, int port, std::string address)
ENABLE_DEEP_COPY NodeDispatcherData()
size_t getBytesSentToSet() const
Vector< size_t > bytesSent