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
StorageClient.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 STORAGE_CLIENT_H
20 #define STORAGE_CLIENT_H
21 
22 namespace pdb {
23 
24 class StorageClient;
25 }
26 
27 #include "ServerFunctionality.h"
28 #include "CatalogClient.h"
29 #include "PDBLogger.h"
30 #include "PDBServer.h"
31 
32 namespace pdb {
33 
34 
35 //this class encapsulates a StorageClient to talk with PangeaStorageServer
36 
38 
39 public:
40  // these give us the port and the address of the catalog
41  StorageClient(int port, std::string address, PDBLoggerPtr myLogger, bool usePangea = false);
42 
43  // function to register event handlers associated with this server functionality
44  virtual void registerHandlers(PDBServer& forMe) override;
45 
46  // this registers a type with the system
47  bool registerType(std::string fileContainingSharedLib, std::string& errMsg);
48 
49  // this returns the type of object in the specified set, as a type name... returns "" on error
50  std::string getObjectType(std::string databaseName, std::string setName, std::string& errMsg);
51 
52  // this creates a new database... returns true on success
53  bool createDatabase(std::string databaseName, std::string& errMsg);
54 
55  // shuts down the server that we are connected to... returns true on success
56  bool shutDownServer(std::string& errMsg);
57 
58  // to flush buffered records into shared memory pages
59  bool flushData(std::string& errMsg);
60 
61 
62  // this creates a new set in a given database... returns true on success
63  template <class DataType>
64  bool createSet(std::string databaseName, std::string setName, std::string& errMsg);
65 
66  // this removes a set from a given database... returns true on success
67  template <class DataType>
68  bool removeSet(std::string databaseName, std::string setName, std::string& errMsg);
69 
70 
71  // this stores data into a set... returns true on success
72  template <class DataType>
74  std::string databaseName,
75  std::string setName,
76  std::string& errMsg,
77  bool typeCheck = true);
78 
80  std::string databaseName,
81  std::string setName,
82  std::string typeName,
83  std::string& errMsg);
84 
85 
86  // this retrieves data into a set... returns true on success
87  template <class DataType>
88  bool retrieveData(std::string databaseName, std::string setName, std::string& errMsg);
89 
90  // this test set scan at backend ... returns true on success
91  template <class DataType>
92  bool scanData(std::string databaseName, std::string setName, std::string& errMsg);
93 
94  // this test set copy at backend ... returns true on success
95  template <class DataType>
96  bool copyData(std::string srcDatabaseName,
97  std::string srcSetName,
98  std::string destDatabaseName,
99  std::string destSetName,
100  std::string& errMsg);
101 
102 
103 private:
105 
106  int port;
107  std::string address;
109 
110  bool usePangea;
111 };
112 }
113 
114 #include "StorageClientTemplate.cc"
115 
116 #endif
virtual void registerHandlers(PDBServer &forMe) override
PDBLoggerPtr myLogger
StorageClient(int port, std::string address, PDBLoggerPtr myLogger, bool usePangea=false)
std::string address
bool retrieveData(std::string databaseName, std::string setName, std::string &errMsg)
CatalogClient myHelper
std::string getObjectType(std::string databaseName, std::string setName, std::string &errMsg)
bool createSet(std::string databaseName, std::string setName, std::string &errMsg)
bool scanData(std::string databaseName, std::string setName, std::string &errMsg)
bool removeSet(std::string databaseName, std::string setName, std::string &errMsg)
bool shutDownServer(std::string &errMsg)
std::shared_ptr< PDBLogger > PDBLoggerPtr
Definition: PDBLogger.h:40
bool createDatabase(std::string databaseName, std::string &errMsg)
bool flushData(std::string &errMsg)
bool copyData(std::string srcDatabaseName, std::string srcSetName, std::string destDatabaseName, std::string destSetName, std::string &errMsg)
bool storeData(Handle< Vector< Handle< DataType >>> data, std::string databaseName, std::string setName, std::string &errMsg, bool typeCheck=true)
bool registerType(std::string fileContainingSharedLib, std::string &errMsg)