-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile_server_client.h
More file actions
38 lines (27 loc) · 1.18 KB
/
file_server_client.h
File metadata and controls
38 lines (27 loc) · 1.18 KB
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
#include "file_server_services.grpc.pb.h"
using grpc::Channel;
using grpc::ClientContext;
using grpc::ClientReader;
using grpc::ClientReaderWriter;
using grpc::ClientWriter;
using grpc::Status;
using FileServer::FileReadWriteRequest;
using FileServer::FileReadWriteResponse;
using FileServer::FileServerService;
class file_server_client {
private:
std::unique_ptr<FileServerService::Stub> stub_;
public:
file_server_client(std::shared_ptr<Channel> channel): stub_(FileServerService::NewStub(channel)){};
fs_read_write_response_t* read_write_request_handler(fs_read_write_request_t *c_req);
int fs_write_file_to_server(cache_block *cb, int start, int end, string file_server);
int fs_read_file_to_server(string file_name, char *buf, int start, int end, string file_server);
int fs_delete_file_from_server(string file_name,string file_server);
};
extern map<string, file_server_client*> fs_connections;
void create_connection_with_server(string ip_port);
extern file_server_client *fs_service;
FileReadWriteRequest::RequestType
fs_get_grpc_type (request_type type);
request_type
get_c_type(FileReadWriteRequest::RequestType type);