0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LoadClient.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 3
9  * of the License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #ifndef Tools_load_generator_LoadClient_h
23 #define Tools_load_generator_LoadClient_h
24 
25 #include <Common/Compat.h>
26 
27 #ifdef HT_WITH_THRIFT
28 #include <ThriftBroker/Client.h>
29 #include <ThriftBroker/Config.h>
31 #endif
32 
33 #include <Hypertable/Lib/Client.h>
34 #include <Hypertable/Lib/Config.h>
35 
36 #include <Common/String.h>
37 
38 #include <boost/algorithm/string.hpp>
39 
40 #include <iostream>
41 #include <fstream>
42 #include <cstdio>
43 #include <cmath>
44 #include <memory>
45 
46 using namespace Hypertable;
47 using namespace Hypertable::Config;
48 using namespace std;
49 using namespace boost;
50 
51 class LoadClient {
52  public:
53  LoadClient(const String &config_file, bool thrift=false);
54  LoadClient(bool thrift=false);
55  ~LoadClient();
56 
57  void create_mutator(const String &tablename, int mutator_flags,
58  ::uint64_t shared_mutator_flush_interval);
64  void create_scanner(const String &tablename, const ScanSpec& scan_spec);
65  void set_cells(const Cells &cells);
66  void set_delete(const KeySpec &key);
67  void flush();
68  void close_scanner();
69 
74  uint64_t get_all_cells();
75 
76  private:
77  bool m_thrift;
84 #ifdef HT_WITH_THRIFT
85  boost::shared_ptr<Thrift::Client> m_thrift_client;
86  ThriftGen::Namespace m_thrift_namespace;
87  ThriftGen::Mutator m_thrift_mutator;
88  ThriftGen::Scanner m_thrift_scanner;
89 #endif
90 };
91 
92 typedef std::shared_ptr<LoadClient> LoadClientPtr;
93 
94 #endif // Tools_load_generator_LoadClient_h
std::vector< Cell, CellAlloc > Cells
Definition: Cells.h:37
Boost library.
Definition: Properties.cc:39
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
bool m_thrift
Definition: LoadClient.h:77
STL namespace.
std::shared_ptr< TableScanner > TableScannerPtr
Smart pointer to TableScanner.
Definition: TableScanner.h:124
NamespacePtr m_ns
Definition: LoadClient.h:79
std::shared_ptr< Namespace > NamespacePtr
Shared smart pointer to Namespace.
Definition: Namespace.h:333
std::shared_ptr< Client > ClientPtr
Definition: Client.h:156
std::shared_ptr< TableMutator > TableMutatorPtr
Smart pointer to TableMutator.
Definition: TableMutator.h:257
Compatibility Macros for C/C++.
bool m_native_table_open
Definition: LoadClient.h:81
TablePtr m_native_table
Definition: LoadClient.h:80
Hypertable definitions
ClientPtr m_native_client
Definition: LoadClient.h:78
TableMutatorPtr m_native_mutator
Definition: LoadClient.h:82
std::shared_ptr< LoadClient > LoadClientPtr
Definition: LoadClient.h:92
A String class based on std::string.
TableScannerPtr m_native_scanner
Definition: LoadClient.h:83
std::shared_ptr< Table > TablePtr
Definition: Table.h:53