-
Notifications
You must be signed in to change notification settings - Fork 4
/
client.h
43 lines (28 loc) · 841 Bytes
/
client.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <string>
#include <vector>
#include <grpc++/grpc++.h>
#include "protoc/rpc.grpc.pb.h"
using grpc::Channel;
using grpc::ClientAsyncResponseReader;
using grpc::ClientContext;
using grpc::CompletionQueue;
using grpc::Status;
// grpc通信
class Client
{
public:
explicit Client(std::shared_ptr<Channel> channel) : stub_(RPC::NewStub(channel)) {}
std::string Setup();
std::string Search(std::string &search_word);
bool Add_Data(unsigned int &add_key, unsigned char (*add_value)[24], std::string &columnfamily);
std::string Delete_Data(const std::string &del_cf);
std::string Show_All();
std::string Random_Gen_DB(int &num);
std::string Destroy();
private:
std::unique_ptr<RPC::Stub> stub_;
};
int client_operate(std::string &op);
void runclient();
void showhelp();