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
DistributedStorageManagerClient.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 #ifndef OBJECTQUERYMODEL_DISTRIBUTEDSTORAGEMANAGERCLIENT_H
19 #define OBJECTQUERYMODEL_DISTRIBUTEDSTORAGEMANAGERCLIENT_H
20 
21 #include "ServerFunctionality.h"
22 #include "PDBLogger.h"
23 
24 #include "SimpleRequestResult.h"
25 
26 namespace pdb {
27 
28 
29 // This functionality talks with the DistributedStorageManagerServer instance
30 // to execute storage-related user requests.
31 
32 
34 
35 public:
37  DistributedStorageManagerClient(int portIn, std::string addressIn, PDBLoggerPtr myLoggerIn);
39 
40  void registerHandlers(PDBServer& forMe); // no - op
41 
42 
43  // TODO: Allow the user to specify what partitioning policy they want to use for this step in
44  // the future
45  bool createDatabase(const std::string& databaseName, std::string& errMsg);
46 
47  bool createSet(const std::string& databaseName,
48  const std::string& setName,
49  const std::string& typeName,
50  std::string& errMsg,
51  size_t pageSize = DEFAULT_PAGE_SIZE);
52 
53  // create a temp set that only goes through storage
54  bool createTempSet(const std::string& databaseName,
55  const std::string& setName,
56  const std::string& typeName,
57  std::string& errMsg,
58  size_t pageSize = DEFAULT_PAGE_SIZE);
59 
60  // templated createSet
61  template <class DataType>
62  bool createSet(const std::string& databaseName,
63  const std::string& setName,
64  std::string& errMsg,
65  size_t pageSize = DEFAULT_PAGE_SIZE);
66 
67  // storage cleanup to flush buffered data to disk
68  bool flushData(std::string& errMsg);
69 
70  bool removeDatabase(const std::string& databaseName, std::string& errMsg);
71 
72  bool removeSet(const std::string& databaseName,
73  const std::string& setName,
74  std::string& errMsg);
75 
76  // clean up all set by removing both in-memory and on-disk data
77  bool clearSet(const std::string& databaseName,
78  const std::string& setName,
79  const std::string& typeName,
80  std::string& errMsg);
81 
82  // remove a temp set that only goes through storage
83  bool removeTempSet(const std::string& databaseName,
84  const std::string& setName,
85  const std::string& typeName,
86  std::string& errMsg);
87 
88  // export set to files with user specified format
89  // the exported set is partitioned over all storage nodes on the specified directory
90  // Note that the objects in set must be instances of ExportableObject
91  bool exportSet(const std::string& databaseName,
92  const std::string& setName,
93  const std::string& outputFilePath,
94  const std::string& format,
95  std::string& errMsg);
96 
97 
98 private:
99  std::function<bool(Handle<SimpleRequestResult>)> generateResponseHandler(
100  std::string description, std::string& errMsg);
101 
102  int port;
103  std::string address;
105 };
106 }
107 
109 #endif // OBJECTQUERYMODEL_DISTRIBUTEDSTORAGEMANAGERCLIENT_H
std::function< bool(Handle< SimpleRequestResult >)> generateResponseHandler(std::string description, std::string &errMsg)
bool createSet(const std::string &databaseName, const std::string &setName, const std::string &typeName, std::string &errMsg, size_t pageSize=DEFAULT_PAGE_SIZE)
bool createTempSet(const std::string &databaseName, const std::string &setName, const std::string &typeName, std::string &errMsg, size_t pageSize=DEFAULT_PAGE_SIZE)
bool clearSet(const std::string &databaseName, const std::string &setName, const std::string &typeName, std::string &errMsg)
bool removeTempSet(const std::string &databaseName, const std::string &setName, const std::string &typeName, std::string &errMsg)
bool createDatabase(const std::string &databaseName, std::string &errMsg)
std::shared_ptr< PDBLogger > PDBLoggerPtr
Definition: PDBLogger.h:40
bool removeSet(const std::string &databaseName, const std::string &setName, std::string &errMsg)
bool exportSet(const std::string &databaseName, const std::string &setName, const std::string &outputFilePath, const std::string &format, std::string &errMsg)
#define DEFAULT_PAGE_SIZE
Definition: Configuration.h:36
bool removeDatabase(const std::string &databaseName, std::string &errMsg)