forked from daniel-j-h/DistributedSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Service.h
43 lines (29 loc) · 815 Bytes
/
Service.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
#ifndef SEARCH_SERVICE_H
#define SEARCH_SERVICE_H
#include <string>
#include "Common.h"
namespace Service {
class Requester final {
public:
Requester(const std::string& address, int timeout = 1000);
~Requester();
// query attached services, return responses (unique, merged) for specific keyword
Common::Response query(const std::string& keyword);
Requester(const Requester&) = delete;
Requester& operator=(const Requester&) = delete;
private:
int sock_;
};
class Responder final {
public:
Responder(const std::string& endpoint);
~Responder();
// wait for requests, process them with user-provided handler
void onRequest(Common::RequestHandler handler);
Responder(const Responder&) = delete;
Responder& operator=(const Responder&) = delete;
private:
int sock_;
};
}
#endif