proxygen
wangle::FactoryToService< Pipeline, Req, Resp > Class Template Reference

#include <Service.h>

Inheritance diagram for wangle::FactoryToService< Pipeline, Req, Resp >:
wangle::Service< Req, Resp >

Public Member Functions

 FactoryToService (std::shared_ptr< ServiceFactory< Pipeline, Req, Resp >> factory)
 
 ~FactoryToService () override=default
 
folly::Future< Resp > operator() (Req request) override
 
- Public Member Functions inherited from wangle::Service< Req, Resp >
virtual ~Service ()=default
 
virtual folly::Future< folly::Unitclose ()
 
virtual bool isAvailable ()
 

Private Attributes

std::shared_ptr< ServiceFactory< Pipeline, Req, Resp > > factory_
 

Detailed Description

template<typename Pipeline, typename Req, typename Resp = Req>
class wangle::FactoryToService< Pipeline, Req, Resp >

Definition at line 131 of file Service.h.

Constructor & Destructor Documentation

template<typename Pipeline, typename Req, typename Resp = Req>
wangle::FactoryToService< Pipeline, Req, Resp >::FactoryToService ( std::shared_ptr< ServiceFactory< Pipeline, Req, Resp >>  factory)
inlineexplicit

Definition at line 133 of file Service.h.

135  : factory_(factory) {}
std::shared_ptr< ServiceFactory< Pipeline, Req, Resp > > factory_
Definition: Service.h:149
template<typename Pipeline, typename Req, typename Resp = Req>
wangle::FactoryToService< Pipeline, Req, Resp >::~FactoryToService ( )
overridedefault

Member Function Documentation

template<typename Pipeline, typename Req, typename Resp = Req>
folly::Future<Resp> wangle::FactoryToService< Pipeline, Req, Resp >::operator() ( Req  request)
inlineoverridevirtual

Implements wangle::Service< Req, Resp >.

Definition at line 138 of file Service.h.

References wangle::Service< Req, Resp >::close(), and folly::gen::move.

138  {
139  DCHECK(factory_);
140  return ((*factory_)(nullptr))
141  .thenValue([=](std::shared_ptr<Service<Req, Resp>> service) {
142  return (*service)(std::move(request)).ensure([this]() {
143  this->close();
144  });
145  });
146  }
std::shared_ptr< ServiceFactory< Pipeline, Req, Resp > > factory_
Definition: Service.h:149
virtual folly::Future< folly::Unit > close()
Definition: Service.h:38
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567

Member Data Documentation

template<typename Pipeline, typename Req, typename Resp = Req>
std::shared_ptr<ServiceFactory<Pipeline, Req, Resp> > wangle::FactoryToService< Pipeline, Req, Resp >::factory_
private

Definition at line 149 of file Service.h.


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