1 // This autogenerated skeleton file illustrates how to build a server.
2 // You should copy it to another filename to avoid overwriting it.
5 #include <thrift/protocol/TBinaryProtocol.h>
6 #include <thrift/server/TSimpleServer.h>
7 #include <thrift/transport/TServerSocket.h>
8 #include <thrift/transport/TBufferTransports.h>
10 using namespace ::apache::thrift
;
11 using namespace ::apache::thrift::protocol
;
12 using namespace ::apache::thrift::transport
;
13 using namespace ::apache::thrift::server
;
15 using namespace ::apache::hadoop::hbase::thrift
;
17 class HbaseHandler
: virtual public HbaseIf
{
20 // Your initialization goes here
23 void enableTable(const Bytes
& tableName
) {
24 // Your implementation goes here
25 printf("enableTable\n");
28 void disableTable(const Bytes
& tableName
) {
29 // Your implementation goes here
30 printf("disableTable\n");
33 bool isTableEnabled(const Bytes
& tableName
) {
34 // Your implementation goes here
35 printf("isTableEnabled\n");
38 void compact(const Bytes
& tableNameOrRegionName
) {
39 // Your implementation goes here
43 void majorCompact(const Bytes
& tableNameOrRegionName
) {
44 // Your implementation goes here
45 printf("majorCompact\n");
48 void getTableNames(std::vector
<Text
> & _return
) {
49 // Your implementation goes here
50 printf("getTableNames\n");
53 void getColumnDescriptors(std::map
<Text
, ColumnDescriptor
> & _return
, const Text
& tableName
) {
54 // Your implementation goes here
55 printf("getColumnDescriptors\n");
58 void getTableRegions(std::vector
<TRegionInfo
> & _return
, const Text
& tableName
) {
59 // Your implementation goes here
60 printf("getTableRegions\n");
63 void createTable(const Text
& tableName
, const std::vector
<ColumnDescriptor
> & columnFamilies
) {
64 // Your implementation goes here
65 printf("createTable\n");
68 void deleteTable(const Text
& tableName
) {
69 // Your implementation goes here
70 printf("deleteTable\n");
73 void get(std::vector
<TCell
> & _return
, const Text
& tableName
, const Text
& row
, const Text
& column
, const std::map
<Text
, Text
> & attributes
) {
74 // Your implementation goes here
78 void getVer(std::vector
<TCell
> & _return
, const Text
& tableName
, const Text
& row
, const Text
& column
, const int32_t numVersions
, const std::map
<Text
, Text
> & attributes
) {
79 // Your implementation goes here
83 void getVerTs(std::vector
<TCell
> & _return
, const Text
& tableName
, const Text
& row
, const Text
& column
, const int64_t timestamp
, const int32_t numVersions
, const std::map
<Text
, Text
> & attributes
) {
84 // Your implementation goes here
88 void getRow(std::vector
<TRowResult
> & _return
, const Text
& tableName
, const Text
& row
, const std::map
<Text
, Text
> & attributes
) {
89 // Your implementation goes here
93 void getRowWithColumns(std::vector
<TRowResult
> & _return
, const Text
& tableName
, const Text
& row
, const std::vector
<Text
> & columns
, const std::map
<Text
, Text
> & attributes
) {
94 // Your implementation goes here
95 printf("getRowWithColumns\n");
98 void getRowTs(std::vector
<TRowResult
> & _return
, const Text
& tableName
, const Text
& row
, const int64_t timestamp
, const std::map
<Text
, Text
> & attributes
) {
99 // Your implementation goes here
100 printf("getRowTs\n");
103 void getRowWithColumnsTs(std::vector
<TRowResult
> & _return
, const Text
& tableName
, const Text
& row
, const std::vector
<Text
> & columns
, const int64_t timestamp
, const std::map
<Text
, Text
> & attributes
) {
104 // Your implementation goes here
105 printf("getRowWithColumnsTs\n");
108 void getRows(std::vector
<TRowResult
> & _return
, const Text
& tableName
, const std::vector
<Text
> & rows
, const std::map
<Text
, Text
> & attributes
) {
109 // Your implementation goes here
113 void getRowsWithColumns(std::vector
<TRowResult
> & _return
, const Text
& tableName
, const std::vector
<Text
> & rows
, const std::vector
<Text
> & columns
, const std::map
<Text
, Text
> & attributes
) {
114 // Your implementation goes here
115 printf("getRowsWithColumns\n");
118 void getRowsTs(std::vector
<TRowResult
> & _return
, const Text
& tableName
, const std::vector
<Text
> & rows
, const int64_t timestamp
, const std::map
<Text
, Text
> & attributes
) {
119 // Your implementation goes here
120 printf("getRowsTs\n");
123 void getRowsWithColumnsTs(std::vector
<TRowResult
> & _return
, const Text
& tableName
, const std::vector
<Text
> & rows
, const std::vector
<Text
> & columns
, const int64_t timestamp
, const std::map
<Text
, Text
> & attributes
) {
124 // Your implementation goes here
125 printf("getRowsWithColumnsTs\n");
128 void mutateRow(const Text
& tableName
, const Text
& row
, const std::vector
<Mutation
> & mutations
, const std::map
<Text
, Text
> & attributes
) {
129 // Your implementation goes here
130 printf("mutateRow\n");
133 void mutateRowTs(const Text
& tableName
, const Text
& row
, const std::vector
<Mutation
> & mutations
, const int64_t timestamp
, const std::map
<Text
, Text
> & attributes
) {
134 // Your implementation goes here
135 printf("mutateRowTs\n");
138 void mutateRows(const Text
& tableName
, const std::vector
<BatchMutation
> & rowBatches
, const std::map
<Text
, Text
> & attributes
) {
139 // Your implementation goes here
140 printf("mutateRows\n");
143 void mutateRowsTs(const Text
& tableName
, const std::vector
<BatchMutation
> & rowBatches
, const int64_t timestamp
, const std::map
<Text
, Text
> & attributes
) {
144 // Your implementation goes here
145 printf("mutateRowsTs\n");
148 int64_t atomicIncrement(const Text
& tableName
, const Text
& row
, const Text
& column
, const int64_t value
) {
149 // Your implementation goes here
150 printf("atomicIncrement\n");
153 void deleteAll(const Text
& tableName
, const Text
& row
, const Text
& column
, const std::map
<Text
, Text
> & attributes
) {
154 // Your implementation goes here
155 printf("deleteAll\n");
158 void deleteAllTs(const Text
& tableName
, const Text
& row
, const Text
& column
, const int64_t timestamp
, const std::map
<Text
, Text
> & attributes
) {
159 // Your implementation goes here
160 printf("deleteAllTs\n");
163 void deleteAllRow(const Text
& tableName
, const Text
& row
, const std::map
<Text
, Text
> & attributes
) {
164 // Your implementation goes here
165 printf("deleteAllRow\n");
168 void increment(const TIncrement
& increment
) {
169 // Your implementation goes here
170 printf("increment\n");
173 void incrementRows(const std::vector
<TIncrement
> & increments
) {
174 // Your implementation goes here
175 printf("incrementRows\n");
178 void deleteAllRowTs(const Text
& tableName
, const Text
& row
, const int64_t timestamp
, const std::map
<Text
, Text
> & attributes
) {
179 // Your implementation goes here
180 printf("deleteAllRowTs\n");
183 ScannerID
scannerOpenWithScan(const Text
& tableName
, const TScan
& scan
, const std::map
<Text
, Text
> & attributes
) {
184 // Your implementation goes here
185 printf("scannerOpenWithScan\n");
188 ScannerID
scannerOpen(const Text
& tableName
, const Text
& startRow
, const std::vector
<Text
> & columns
, const std::map
<Text
, Text
> & attributes
) {
189 // Your implementation goes here
190 printf("scannerOpen\n");
193 ScannerID
scannerOpenWithStop(const Text
& tableName
, const Text
& startRow
, const Text
& stopRow
, const std::vector
<Text
> & columns
, const std::map
<Text
, Text
> & attributes
) {
194 // Your implementation goes here
195 printf("scannerOpenWithStop\n");
198 ScannerID
scannerOpenWithPrefix(const Text
& tableName
, const Text
& startAndPrefix
, const std::vector
<Text
> & columns
, const std::map
<Text
, Text
> & attributes
) {
199 // Your implementation goes here
200 printf("scannerOpenWithPrefix\n");
203 ScannerID
scannerOpenTs(const Text
& tableName
, const Text
& startRow
, const std::vector
<Text
> & columns
, const int64_t timestamp
, const std::map
<Text
, Text
> & attributes
) {
204 // Your implementation goes here
205 printf("scannerOpenTs\n");
208 ScannerID
scannerOpenWithStopTs(const Text
& tableName
, const Text
& startRow
, const Text
& stopRow
, const std::vector
<Text
> & columns
, const int64_t timestamp
, const std::map
<Text
, Text
> & attributes
) {
209 // Your implementation goes here
210 printf("scannerOpenWithStopTs\n");
213 void scannerGet(std::vector
<TRowResult
> & _return
, const ScannerID id
) {
214 // Your implementation goes here
215 printf("scannerGet\n");
218 void scannerGetList(std::vector
<TRowResult
> & _return
, const ScannerID id
, const int32_t nbRows
) {
219 // Your implementation goes here
220 printf("scannerGetList\n");
223 void scannerClose(const ScannerID id
) {
224 // Your implementation goes here
225 printf("scannerClose\n");
228 void getRowOrBefore(std::vector
<TCell
> & _return
, const Text
& tableName
, const Text
& row
, const Text
& family
) {
229 // Your implementation goes here
230 printf("getRowOrBefore\n");
233 void getRegionInfo(TRegionInfo
& _return
, const Text
& row
) {
234 // Your implementation goes here
235 printf("getRegionInfo\n");
240 int main(int argc
, char **argv
) {
242 std::shared_ptr
<HbaseHandler
> handler(new HbaseHandler());
243 std::shared_ptr
<TProcessor
> processor(new HbaseProcessor(handler
));
244 std::shared_ptr
<TServerTransport
> serverTransport(new TServerSocket(port
));
245 std::shared_ptr
<TTransportFactory
> transportFactory(new TBufferedTransportFactory());
246 std::shared_ptr
<TProtocolFactory
> protocolFactory(new TBinaryProtocolFactory());
248 TSimpleServer
server(processor
, serverTransport
, transportFactory
, protocolFactory
);