|
RDFS
The Rice Comp413 2017 class' continuation on the work of the 2016 RDFS.
|
Public Member Functions | |
| RPCServer (int port) | |
| void | serve (asio::io_service &io_service) |
| void | register_handler (std::string key, std::function< std::string(std::string)> handler) |
| std::string | getUsername () |
|
explicit |
Construct an RPC server that will listen on given port.
| std::string RPCServer::getUsername | ( | ) |
Returns the name of the current running linux user.
Returns the current user's name.
| void RPCServer::register_handler | ( | std::string | key, |
| std::function< std::string(std::string)> | handler | ||
| ) |
Register a handler function for the given key, such that when a request for method of name key arrives, the registered handler is called.
| key | is the method name specified in the request header. |
| handler | takes as input a string the bytes of the method's input protobuf, and should return a string of bytes of the method's output protobuf (so the handler should parse and serialize protobufs) |
Register given handler function on the provided method key. The function's input will be a string of bytes corresponding to the Proto of its input. Exepct the function to return a string of serialized bytes of its specified output Proto.
| void RPCServer::serve | ( | asio::io_service & | io_service | ) |
Begin the listen-loop of the RPC server. This method does not return.
Begin the server's main listen loop using provided io service.
1.8.6