proxygen
wangle::OutboundContextImpl< H > Class Template Reference

#include <HandlerContext-inl.h>

Inheritance diagram for wangle::OutboundContextImpl< H >:
wangle::OutboundHandlerContext< H::wout > wangle::OutboundLink< H::win > wangle::ContextImplBase< H, OutboundHandlerContext< H::wout > > wangle::PipelineContext

Public Types

typedef H::rin Rin
 
typedef H::rout Rout
 
typedef H::win Win
 
typedef H::wout Wout
 

Public Member Functions

 OutboundContextImpl (std::weak_ptr< PipelineBase > pipeline, std::shared_ptr< H > handler)
 
 OutboundContextImpl ()
 
 ~OutboundContextImpl () override=default
 
folly::Future< folly::UnitfireWrite (Wout msg) override
 
folly::Future< folly::UnitfireWriteException (folly::exception_wrapper e) override
 
folly::Future< folly::UnitfireClose () override
 
PipelineBasegetPipeline () override
 
std::shared_ptr< PipelineBasegetPipelineShared () override
 
folly::Future< folly::Unitwrite (Win msg) override
 
folly::Future< folly::UnitwriteException (folly::exception_wrapper e) override
 
folly::Future< folly::Unitclose () override
 
- Public Member Functions inherited from wangle::OutboundHandlerContext< H::wout >
virtual ~OutboundHandlerContext ()=default
 
std::shared_ptr< folly::AsyncTransportgetTransport ()
 
- Public Member Functions inherited from wangle::ContextImplBase< H, OutboundHandlerContext< H::wout > >
 ~ContextImplBase () override=default
 
H * getHandler ()
 
void initialize (std::weak_ptr< PipelineBase > pipeline, std::shared_ptr< H > handler)
 
void attachPipeline () override
 
void detachPipeline () override
 
void setNextIn (PipelineContext *ctx) override
 
void setNextOut (PipelineContext *ctx) override
 
HandlerDir getDirection () override
 
- Public Member Functions inherited from wangle::PipelineContext
virtual ~PipelineContext ()=default
 
template<class H , class HandlerContext >
void attachContext (H *handler, HandlerContext *ctx)
 
template<class H , class HandlerContext >
void detachContext (H *handler, HandlerContext *)
 

Static Public Attributes

static const HandlerDir dir = HandlerDir::OUT
 

Additional Inherited Members

- Protected Attributes inherited from wangle::ContextImplBase< H, OutboundHandlerContext< H::wout > >
OutboundHandlerContext< H::wout > * impl_
 
std::weak_ptr< PipelineBasepipelineWeak_
 
PipelineBasepipelineRaw_
 
std::shared_ptr< H > handler_
 
InboundLink< typename H::rout > * nextIn_
 
OutboundLink< typename H::wout > * nextOut_
 

Detailed Description

template<class H>
class wangle::OutboundContextImpl< H >

Definition at line 426 of file HandlerContext-inl.h.

Member Typedef Documentation

template<class H >
typedef H::rin wangle::OutboundContextImpl< H >::Rin

Definition at line 431 of file HandlerContext-inl.h.

template<class H >
typedef H::rout wangle::OutboundContextImpl< H >::Rout

Definition at line 432 of file HandlerContext-inl.h.

template<class H >
typedef H::win wangle::OutboundContextImpl< H >::Win

Definition at line 433 of file HandlerContext-inl.h.

template<class H >
typedef H::wout wangle::OutboundContextImpl< H >::Wout

Definition at line 434 of file HandlerContext-inl.h.

Constructor & Destructor Documentation

template<class H >
wangle::OutboundContextImpl< H >::OutboundContextImpl ( std::weak_ptr< PipelineBase pipeline,
std::shared_ptr< H >  handler 
)
inlineexplicit

Definition at line 437 of file HandlerContext-inl.h.

References folly::gen::move.

439  {
440  this->impl_ = this;
441  this->initialize(pipeline, std::move(handler));
442  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void handler(int, siginfo_t *, void *)
void initialize(std::weak_ptr< PipelineBase > pipeline, std::shared_ptr< H > handler)
template<class H >
wangle::OutboundContextImpl< H >::OutboundContextImpl ( )
inline

Definition at line 445 of file HandlerContext-inl.h.

445  {
446  this->impl_ = this;
447  }
template<class H >
wangle::OutboundContextImpl< H >::~OutboundContextImpl ( )
overridedefault

Member Function Documentation

template<class H >
folly::Future<folly::Unit> wangle::OutboundContextImpl< H >::close ( )
inlineoverridevirtual

Implements wangle::OutboundLink< H::win >.

Definition at line 503 of file HandlerContext-inl.h.

References folly::gen::guard().

503  {
504  auto guard = this->pipelineWeak_.lock();
505  return this->handler_->close(this);
506  }
GuardImpl guard(ErrorHandler &&handler)
Definition: Base.h:840
template<class H >
folly::Future<folly::Unit> wangle::OutboundContextImpl< H >::fireClose ( )
inlineoverridevirtual

Implements wangle::OutboundHandlerContext< H::wout >.

Definition at line 473 of file HandlerContext-inl.h.

References folly::gen::guard(), folly::makeFuture(), and folly::WARNING.

473  {
474  auto guard = this->pipelineWeak_.lock();
475  if (this->nextOut_) {
476  return this->nextOut_->close();
477  } else {
478  LOG(WARNING) << "close reached end of pipeline";
479  return folly::makeFuture();
480  }
481  }
GuardImpl guard(ErrorHandler &&handler)
Definition: Base.h:840
Future< typename std::decay< T >::type > makeFuture(T &&t)
Definition: Future-inl.h:1310
template<class H >
folly::Future<folly::Unit> wangle::OutboundContextImpl< H >::fireWrite ( Wout  msg)
inlineoverridevirtual

Implements wangle::OutboundHandlerContext< H::wout >.

Definition at line 452 of file HandlerContext-inl.h.

References folly::gen::guard(), folly::makeFuture(), and folly::WARNING.

452  {
453  auto guard = this->pipelineWeak_.lock();
454  if (this->nextOut_) {
455  return this->nextOut_->write(std::forward<Wout>(msg));
456  } else {
457  LOG(WARNING) << "write reached end of pipeline";
458  return folly::makeFuture();
459  }
460  }
GuardImpl guard(ErrorHandler &&handler)
Definition: Base.h:840
Future< typename std::decay< T >::type > makeFuture(T &&t)
Definition: Future-inl.h:1310
template<class H >
folly::Future<folly::Unit> wangle::OutboundContextImpl< H >::fireWriteException ( folly::exception_wrapper  e)
inlineoverridevirtual

Implements wangle::OutboundHandlerContext< H::wout >.

Definition at line 462 of file HandlerContext-inl.h.

References folly::gen::guard(), folly::makeFuture(), folly::gen::move, and folly::WARNING.

463  {
464  auto guard = this->pipelineWeak_.lock();
465  if (this->nextOut_) {
466  return this->nextOut_->writeException(std::move(e));
467  } else {
468  LOG(WARNING) << "close reached end of pipeline";
469  return folly::makeFuture();
470  }
471  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
GuardImpl guard(ErrorHandler &&handler)
Definition: Base.h:840
Future< typename std::decay< T >::type > makeFuture(T &&t)
Definition: Future-inl.h:1310
template<class H >
PipelineBase* wangle::OutboundContextImpl< H >::getPipeline ( )
inlineoverridevirtual

Implements wangle::OutboundHandlerContext< H::wout >.

Definition at line 483 of file HandlerContext-inl.h.

483  {
484  return this->pipelineRaw_;
485  }
template<class H >
std::shared_ptr<PipelineBase> wangle::OutboundContextImpl< H >::getPipelineShared ( )
inlineoverridevirtual

Implements wangle::OutboundHandlerContext< H::wout >.

Definition at line 487 of file HandlerContext-inl.h.

487  {
488  return this->pipelineWeak_.lock();
489  }
template<class H >
folly::Future<folly::Unit> wangle::OutboundContextImpl< H >::write ( Win  msg)
inlineoverridevirtual

Implements wangle::OutboundLink< H::win >.

Definition at line 492 of file HandlerContext-inl.h.

References folly::gen::guard().

492  {
493  auto guard = this->pipelineWeak_.lock();
494  return this->handler_->write(this, std::forward<Win>(msg));
495  }
GuardImpl guard(ErrorHandler &&handler)
Definition: Base.h:840
template<class H >
folly::Future<folly::Unit> wangle::OutboundContextImpl< H >::writeException ( folly::exception_wrapper  e)
inlineoverridevirtual

Implements wangle::OutboundLink< H::win >.

Definition at line 497 of file HandlerContext-inl.h.

References folly::gen::guard(), and folly::gen::move.

498  {
499  auto guard = this->pipelineWeak_.lock();
500  return this->handler_->writeException(this, std::move(e));
501  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
GuardImpl guard(ErrorHandler &&handler)
Definition: Base.h:840

Member Data Documentation

template<class H >
const HandlerDir wangle::OutboundContextImpl< H >::dir = HandlerDir::OUT
static

Definition at line 435 of file HandlerContext-inl.h.


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