GPUdb C++ API  Version 7.0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RecordRetriever.hpp
Go to the documentation of this file.
1 #ifndef __RECORD_RETRIEVER_HPP__
2 #define __RECORD_RETRIEVER_HPP__
3 
4 #include "gpudb/GPUdb.hpp"
5 #include "gpudb/Http.hpp"
6 #include "gpudb/Type.hpp"
8 
9 
10 #include <atomic>
11 #include <map>
12 #include <string>
13 #include <vector>
14 
15 #include <boost/noncopyable.hpp>
16 #include <boost/shared_ptr.hpp>
17 
18 
19 namespace gpudb
20 {
21 
22 // Forward declaration
23 class GPUdb;
24 
25 
37 class RecordRetriever : private boost::noncopyable
38 {
39 
40 public:
41 
42  RecordRetriever( const gpudb::GPUdb& db, const gpudb::Type& record_type,
43  const std::string& table_name,
44  const WorkerList& worker_list );
45 
46  RecordRetriever( const gpudb::GPUdb& db, const gpudb::Type& record_type,
47  const std::string& table_name );
48 
49  RecordRetriever( const gpudb::GPUdb& db, const gpudb::Type& record_type,
50  const std::string& table_name,
51  const WorkerList& worker_list,
52  const std::map<std::string, std::string>& retrieval_options );
53 
54  RecordRetriever( const gpudb::GPUdb& db, const gpudb::Type& record_type,
55  const std::string& table_name,
56  const std::map<std::string, std::string>& retrieval_options );
57 
58 
60 
64  const std::string& getTableName() const { return m_table_name; }
65 
69  const gpudb::GPUdb& getGPUdb() const { return m_db; }
70 
71 
79  const std::map<std::string, std::string>& getOptions() const { return m_retrieval_options; }
80 
81 
88  void setOptions( const std::map<std::string, std::string>& options );
89 
90 
110  const std::string& expression = "" );
111 
112 
113 private:
114 
115  typedef std::map<std::string, std::string> str_to_str_map_t;
116  typedef boost::shared_ptr<gpudb::WorkerQueue> worker_queue_ptr_t;
117 
118 
119  RecordRetriever();
120 
121  void construct( const gpudb::GPUdb& db,
122  const gpudb::Type& record_type,
123  const std::string& table_name,
124  const WorkerList& worker_list,
125  const std::map<std::string, std::string>& retrieval_options );
126 
127  const gpudb::GPUdb& m_db;
128  std::string m_table_name;
129  gpudb::Type m_record_type;
130  gpudb::RecordKeyBuilder* m_shard_key_builder_ptr;
131  std::vector<int32_t> m_routing_table;
132  std::vector<worker_queue_ptr_t> m_worker_queues;
133  str_to_str_map_t m_retrieval_options;
134 
135 }; // end class RecordRetriever
136 
137 
138 
139 } // namespace gpudb
140 
141 
142 
143 #endif // __RECORD_RETRIEVER_HPP__
144 
145 
GetRecordsResponse< gpudb::GenericRecord > getRecordsByKey(const gpudb::GenericRecord &record, const std::string &expression="")
Retrieves records for a given shard key, optionally further limited by an additional expression...
void setOptions(const std::map< std::string, std::string > &options)
Returns the options currently used for the retriever methods.
The multi-head record retriever class.
const std::string & getTableName() const
Returns the name of the table on which this class operates.
const std::map< std::string, std::string > & getOptions() const
Gets the options currently used for the retriever methods.
const gpudb::GPUdb & getGPUdb() const
Returns the GPUdb client handle that this class uses internally.
A set of output parameters for const.
Definition: get_records.h:404