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

#include <ClientDispatcher.h>

Inheritance diagram for wangle::SerialClientDispatcher< Pipeline, Req, Resp >:
wangle::ClientDispatcherBase< Pipeline, Req, Resp > wangle::HandlerAdapter< Resp, Req > wangle::Service< Req, Resp > wangle::Handler< Resp, Resp, Req, Req > wangle::HandlerBase< HandlerContext< Resp, Req > >

Public Types

typedef HandlerAdapter< Resp, Req >::Context Context
 
- Public Types inherited from wangle::ClientDispatcherBase< Pipeline, Req, Resp >
typedef HandlerAdapter< Resp, Req >::Context Context
 
- Public Types inherited from wangle::HandlerAdapter< Resp, Req >
typedef Handler< Resp, Resp, Req, Req >::Context Context
 
- Public Types inherited from wangle::Handler< Resp, Resp, Req, Req >
typedef Resp rin
 
typedef Resp rout
 
typedef Req win
 
typedef Req wout
 
typedef HandlerContext< Resp, ReqContext
 

Public Member Functions

void read (Context *, Resp in) override
 
folly::Future< Resp > operator() (Req arg) override
 
- Public Member Functions inherited from wangle::ClientDispatcherBase< Pipeline, Req, Resp >
 ~ClientDispatcherBase () override
 
void setPipeline (Pipeline *pipeline)
 
folly::Future< folly::Unitclose () override
 
folly::Future< folly::Unitclose (Context *ctx) override
 
- Public Member Functions inherited from wangle::HandlerAdapter< Resp, Req >
void read (Context *ctx, Respmsg) override
 
folly::Future< folly::Unitwrite (Context *ctx, Reqmsg) override
 
- Public Member Functions inherited from wangle::Handler< Resp, Resp, Req, Req >
 ~Handler () override=default
 
virtual void readEOF (Context *ctx)
 
virtual void readException (Context *ctx, folly::exception_wrapper e)
 
virtual void transportActive (Context *ctx)
 
virtual void transportInactive (Context *ctx)
 
virtual folly::Future< folly::UnitwriteException (Context *ctx, folly::exception_wrapper e)
 
virtual folly::Future< folly::Unitclose (Context *ctx)
 
- Public Member Functions inherited from wangle::HandlerBase< HandlerContext< Resp, Req > >
virtual ~HandlerBase ()=default
 
virtual void attachPipeline (HandlerContext< Resp, Req > *)
 
virtual void detachPipeline (HandlerContext< Resp, Req > *)
 
HandlerContext< Resp, Req > * getContext ()
 
- Public Member Functions inherited from wangle::Service< Req, Resp >
virtual ~Service ()=default
 
virtual bool isAvailable ()
 

Private Attributes

folly::Optional< folly::Promise< Resp > > p_
 

Additional Inherited Members

- Static Public Attributes inherited from wangle::Handler< Resp, Resp, Req, Req >
static const HandlerDir dir
 
- Protected Attributes inherited from wangle::ClientDispatcherBase< Pipeline, Req, Resp >
Pipelinepipeline_ {nullptr}
 

Detailed Description

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

Dispatch a request, satisfying Promise p with the response; the returned Future is satisfied when the response is received: only one request is allowed at a time.

Definition at line 69 of file ClientDispatcher.h.

Member Typedef Documentation

template<typename Pipeline, typename Req, typename Resp = Req>
typedef HandlerAdapter<Resp, Req>::Context wangle::SerialClientDispatcher< Pipeline, Req, Resp >::Context

Definition at line 72 of file ClientDispatcher.h.

Member Function Documentation

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

Implements wangle::Service< Req, Resp >.

Definition at line 80 of file ClientDispatcher.h.

80  {
81  CHECK(!p_);
82  DCHECK(this->pipeline_);
83 
85  auto f = p_->getFuture();
86  this->pipeline_->write(std::move(arg));
87  return f;
88  }
auto f
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
folly::Optional< folly::Promise< Resp > > p_
std::enable_if<!std::is_same< T, folly::Unit >::value, folly::Future< folly::Unit > >::type write(W msg)
Definition: Pipeline-inl.h:235
template<typename Pipeline, typename Req, typename Resp = Req>
void wangle::SerialClientDispatcher< Pipeline, Req, Resp >::read ( Context ,
Resp  in 
)
inlineoverride

Definition at line 74 of file ClientDispatcher.h.

74  {
75  DCHECK(p_);
76  p_->setValue(std::move(in));
77  p_ = folly::none;
78  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
folly::Optional< folly::Promise< Resp > > p_
constexpr None none
Definition: Optional.h:87

Member Data Documentation

template<typename Pipeline, typename Req, typename Resp = Req>
folly::Optional<folly::Promise<Resp> > wangle::SerialClientDispatcher< Pipeline, Req, Resp >::p_
private

Definition at line 91 of file ClientDispatcher.h.


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