proxygen
RpcService Class Reference
Inheritance diagram for RpcService:
wangle::Service< Bonk, Xtruct >

Public Member Functions

Future< Xtruct > operator() (Bonk request) override
 
- Public Member Functions inherited from wangle::Service< Bonk, Xtruct >
virtual ~Service ()=default
 
virtual folly::Future< folly::Unitclose ()
 
virtual bool isAvailable ()
 

Detailed Description

Definition at line 42 of file RpcServer.cpp.

Member Function Documentation

Future<Xtruct> RpcService::operator() ( Bonk  request)
inlineoverridevirtual

Implements wangle::Service< Bonk, Xtruct >.

Definition at line 44 of file RpcServer.cpp.

References folly::futures::sleep().

44  {
45  // Oh no, we got Bonked! Quick, Bonk back
46  printf("Bonk: %s, %i\n", request.message.c_str(), request.type);
47 
48  /* sleep override: ignore lint
49  * useful for testing dispatcher behavior by hand
50  */
51  // Wait for a bit
52  return futures::sleep(std::chrono::seconds(request.type))
53  .thenValue([request](auto&&) {
54  Xtruct response;
55  response.string_thing = "Stop saying " + request.message + "!";
56  response.i32_thing = request.type;
57  return response;
58  });
59  }
Future< Unit > sleep(Duration dur, Timekeeper *tk)
Definition: Future.cpp:42

The documentation for this class was generated from the following file: