Simple example for thrift1 is OK, but I try thrift2
int main(int argc, char** argv)
{
bool isFramed = false;
boost::shared_ptr<TTransport> socket(new TSocket("localhost", 9090));
boost::shared_ptr<TTransport> transport;
if (isFramed) {
transport.reset(new TFramedTransport(socket));
} else {
transport.reset(new TBufferedTransport(socket));
}
boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
THBaseServiceClient client(protocol);
try{
transport->open();
std::cout << "insert..." << std::endl;
TPut tput;
TColumnValue val;
val.family="d";
val.qualifier="col1";
val.value="1";
tput.row = "001";
tput.columnValues.push_back(val);
client.put("btc_addr", tput);
transport->close();
}
catch (const TException &tx) {
std::cerr << "ERROR: " << tx.what() << std::endl;
}
return 0;
}
Is error: Invalid method name for 'put'
btw: Thrift2 is faster than Thrift1?