-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelloHandler.h
32 lines (23 loc) · 875 Bytes
/
HelloHandler.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
#pragma once
#include <folly/Memory.h>
#include <folly/executors/IOThreadPoolExecutor.h>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/futures/Future.h>
#include <proxygen/httpserver/RequestHandler.h>
using namespace proxygen;
namespace hello {
class HelloHandler : public RequestHandler {
public:
explicit HelloHandler(folly::CPUThreadPoolExecutor *);
void onRequest(std::unique_ptr<HTTPMessage> headers) noexcept override;
void onBody(std::unique_ptr<folly::IOBuf> body) noexcept override;
void onEOM() noexcept override;
void onUpgrade(UpgradeProtocol protocol) noexcept override;
void requestComplete() noexcept override;
void onError(ProxygenError err) noexcept override;
private:
std::unique_ptr<folly::IOBuf> body_;
folly::Future<int> add(int x, int y);
folly::CPUThreadPoolExecutor *cpuPool_;
};
} // namespace hello