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
RegisterReplica.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 REGISTER_REPLICA_H
20 #define REGISTER_REPLICA_H
21 
22 #include "Object.h"
23 #include "PDBString.h"
24 #include "Computation.h"
25 
26 // PRELOAD %RegisterReplica%
27 
28 namespace pdb {
29 
30 // encapsulates a request to run a register a replica with the statistics database
31 class RegisterReplica : public Object {
32 
33 public:
34  //default constructor
36 
37  //destructor
39 
40  /*
41  * constructor
42  * @param inputDatabaseAndSet: input set that is used to generate the replica
43  * @param outputDatabaseAndSet: output set to store the replica
44  * @param numPartitions: number of partitions
45  * @param numNodes: number of nodes
46  * @param replicaType: type of operations that transforms the input set to the output set
47  * @param tcapString: tcapString related with the output
48  */
49  RegisterReplica(std::pair<std::string, std::string> inputDatabaseAndSet,
50  std::pair<std::string, std::string> outputDatabaseAndSet,
51  int numPartitions,
52  int numNodes,
53  std::string replicaType,
54  std::string tcapString,
55  std::vector<Handle<Computation>> inputComputations) {
56  this->inputDatabaseName = inputDatabaseAndSet.first;
57  this->inputSetName = inputDatabaseAndSet.second;
58  this->outputDatabaseName = outputDatabaseAndSet.first;
59  this->outputSetName = outputDatabaseAndSet.second;
60  this->numPartitions = numPartitions;
61  this->numNodes = numNodes;
62  this->replicaType = replicaType;
63  this->tcapString = tcapString;
64  this->computations = makeObject<Vector<Handle<Computation>>>();
65  size_t numComputations = inputComputations.size();
66  for (size_t i=0; i < numComputations; i++) {
67  this->computations->push_back(inputComputations[i]);
68  }
69  }
70 
71  /*
72  * getters/setters
73  */
74 
75  void setTCAPString(std::string tcapString) {
76  this->tcapString = tcapString;
77  }
78 
79  std::string getTCAPString() {
80  return tcapString;
81  }
82 
84  this->inputDatabaseName = inputDatabaseName;
85  }
86 
87  std::string getInputDatabaseName() {
88  return this->inputDatabaseName;
89  }
90 
91  void setInputSetName(std::string inputSetName) {
92  this->inputSetName = inputSetName;
93  }
94 
95  std::string getInputSetName() {
96  return this->inputSetName;
97  }
98 
100  this->outputDatabaseName = outputDatabaseName;
101  }
102 
103  std::string getOutputDatabaseName() {
104  return this->outputDatabaseName;
105  }
106 
107  void setOutputSetName(std::string outputSetName) {
108  this->outputSetName = outputSetName;
109  }
110 
111  std::string getOutputSetName() {
112  return this->outputSetName;
113  }
114 
116  this->numPartitions = numPartitions;
117  }
118 
120  return this->numPartitions;
121  }
122 
123  void setNumNodes(int numNodes) {
124  this->numNodes = numNodes;
125  }
126 
127  int getNumNodes() {
128  return this->numNodes;
129  }
130 
131 
132  void setReplicaType (std::string replicaType) {
133  this->replicaType = replicaType;
134  }
135 
136  std::string getReplicaType() {
137  return replicaType;
138  }
139 
141  return computations;
142  }
143 
144  void print() {
145  std::cout << "inputDatabaseName is " << inputDatabaseName << std::endl;
146  std::cout << "inputSetName is " << inputSetName << std::endl;
147  std::cout << "outputDatabaseName is " << outputDatabaseName << std::endl;
148  std::cout << "outputSetName is " << outputSetName << std::endl;
149  std::cout << "number of computation: " << computations->size() << std::endl;
150  }
151 
153 
154 private:
155  //input database name
157 
158  //input set name
160 
161  //output database name
163 
164  //output set name
166 
167  //number of partitions
169 
170  //number of nodes
171  int numNodes;
172 
173  //type of replica
175 
176  //tcap string that is used to produce replica
178 
179  //computations
181 
182 };
183 }
184 
185 #endif
#define ENABLE_DEEP_COPY
Definition: DeepCopy.h:52
std::string getOutputSetName()
Handle< Vector< Handle< Computation > > > computations
std::string getInputSetName()
void setTCAPString(std::string tcapString)
std::string getTCAPString()
Handle< Vector< Handle< Computation > > > getComputations()
void setReplicaType(std::string replicaType)
void setOutputDatabaseName(std::string outputDatabaseName)
RegisterReplica(std::pair< std::string, std::string > inputDatabaseAndSet, std::pair< std::string, std::string > outputDatabaseAndSet, int numPartitions, int numNodes, std::string replicaType, std::string tcapString, std::vector< Handle< Computation >> inputComputations)
void setInputSetName(std::string inputSetName)
void setOutputSetName(std::string outputSetName)
std::string getOutputDatabaseName()
void setNumNodes(int numNodes)
void setNumPartitions(int numPartitions)
void setInputDatabaseName(std::string inputDatabaseName)
std::string getReplicaType()
std::string getInputDatabaseName()