MCPcopy Create free account
hub / github.com/baidu/braft / BlockServiceImpl

Class BlockServiceImpl

example/block/server.cpp:442–463  ·  view source on GitHub ↗

Implements example::BlockService if you are using brpc.

Source from the content-addressed store, hash-verified

440
441// Implements example::BlockService if you are using brpc.
442class BlockServiceImpl : public BlockService {
443public:
444 explicit BlockServiceImpl(Block* block) : _block(block) {}
445 void write(::google::protobuf::RpcController* controller,
446 const ::example::BlockRequest* request,
447 ::example::BlockResponse* response,
448 ::google::protobuf::Closure* done) {
449 brpc::Controller* cntl = (brpc::Controller*)controller;
450 return _block->write(request, response,
451 &cntl->request_attachment(), done);
452 }
453 void read(::google::protobuf::RpcController* controller,
454 const ::example::BlockRequest* request,
455 ::example::BlockResponse* response,
456 ::google::protobuf::Closure* done) {
457 brpc::Controller* cntl = (brpc::Controller*)controller;
458 brpc::ClosureGuard done_guard(done);
459 return _block->read(request, response, &cntl->response_attachment());
460 }
461private:
462 Block* _block;
463};
464
465} // namespace example
466

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected