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
Partitioner.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 PARTITIONER_H
20 #define PARTITIONER_H
21 
22 #include "PartitionComp.h"
24 #include "InterfaceFunctions.h"
25 #include "ScanUserSet.h"
26 #include "WriteUserSet.h"
27 #include "QueryClient.h"
28 #include "StatisticsDB.h"
29 #include <cstring>
30 #include <vector>
31 
32 namespace pdb {
33 
34 /* this class implements a partitioner that partitions data stored in a created set using the specified partition computation */
35 
36 template<class KeyClass, class ValueClass>
37 class Partitioner {
38 
39 
40 public:
41 
42  /* constructor
43  * @param inputDatabaseAndSet: the input pair of database name and set name, the set is expected to be created and often non-empty before being called by this function;
44  * @param outputDatabaseAndSet: the output pair of database name and set name, the set is expected to be created and often empty before being called by this function;
45  */
46  Partitioner (std::pair<std::string, std::string> inputDatabaseAndSet,
47  std::pair<std::string, std::string> outputDatabaseAndSet);
48 
49 
50  /* to partition the data stored in the inputDatabaseAndSet */
51  /* @param errMsg: error message
52  * @param queryClient: the client used to send partition at the server
53  * @return: whether this execution succeeds or not */
54  bool partition ( std::string & errMsg,
55  std::shared_ptr<pdb::QueryClient> queryClient,
57 
58 
59  /* to extract, partition and store the key in the data stored in the inputDatabaseAndSet*/
60  /* @param errMsg: error message
61  * @param queryClient: the client used to send partition at the server
62  * @return: whether this execution succeeds or not */
63  bool partitionWithTransformation ( std::string & errMsg,
64  std::shared_ptr<pdb::QueryClient> queryClient,
66 
67 
68 private:
69 
70  /* the input set identifier */
71  std::pair<std::string, std::string> inputDatabaseAndSet;
72 
73  /* the output set identifier */
74  std::pair<std::string, std::string> outputDatabaseAndSet;
75 
76 
77 };
78 
79 
80 }
81 
82 #include "Partitioner.cc"
83 
84 #endif
Partitioner(std::pair< std::string, std::string > inputDatabaseAndSet, std::pair< std::string, std::string > outputDatabaseAndSet)
Definition: Partitioner.cc:27
std::pair< std::string, std::string > outputDatabaseAndSet
Definition: Partitioner.h:74
std::pair< std::string, std::string > inputDatabaseAndSet
Definition: Partitioner.h:71
bool partitionWithTransformation(std::string &errMsg, std::shared_ptr< pdb::QueryClient > queryClient, Handle< PartitionTransformationComp< KeyClass, ValueClass >> partitionComp)
Definition: Partitioner.cc:89
bool partition(std::string &errMsg, std::shared_ptr< pdb::QueryClient > queryClient, Handle< PartitionComp< KeyClass, ValueClass >> partitionComp)
Definition: Partitioner.cc:35