proxygen
wangle::RoutingDataHandler< R > Class Template Referenceabstract

#include <RoutingDataHandler.h>

Inheritance diagram for wangle::RoutingDataHandler< R >:
wangle::HandlerAdapter< R, W > wangle::Handler< R, R, W, W > wangle::HandlerBase< HandlerContext< R, W > >

Classes

class  Callback
 
struct  RoutingData
 

Public Member Functions

 RoutingDataHandler (uint64_t connId, Callback *cob)
 
 ~RoutingDataHandler () override
 
void read (Context *ctx, folly::IOBufQueue &q) override
 
void readEOF (Context *ctx) override
 
void readException (Context *ctx, folly::exception_wrapper ex) override
 
virtual bool parseRoutingData (folly::IOBufQueue &bufQueue, RoutingData &routingData)=0
 
- Public Member Functions inherited from wangle::HandlerAdapter< R, W >
void read (Context *ctx, R msg) override
 
folly::Future< folly::Unitwrite (Context *ctx, W msg) override
 
- Public Member Functions inherited from wangle::Handler< R, R, W, W >
 ~Handler () override=default
 
virtual void read (Context *ctx, Rmsg)=0
 
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::Unitwrite (Context *ctx, Wmsg)=0
 
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< R, W > >
virtual ~HandlerBase ()=default
 
virtual void attachPipeline (HandlerContext< R, W > *)
 
virtual void detachPipeline (HandlerContext< R, W > *)
 
HandlerContext< R, W > * getContext ()
 

Private Attributes

uint64_t connId_
 
Callbackcob_ {nullptr}
 

Additional Inherited Members

- Public Types inherited from wangle::HandlerAdapter< R, W >
typedef Handler< R, R, W, W >::Context Context
 
- Public Types inherited from wangle::Handler< R, R, W, W >
typedef R rin
 
typedef R rout
 
typedef W win
 
typedef W wout
 
typedef HandlerContext< R, W > Context
 
- Static Public Attributes inherited from wangle::Handler< R, R, W, W >
static const HandlerDir dir
 

Detailed Description

template<typename R>
class wangle::RoutingDataHandler< R >

Definition at line 23 of file RoutingDataHandler.h.

Constructor & Destructor Documentation

template<typename R >
wangle::RoutingDataHandler< R >::RoutingDataHandler ( uint64_t  connId,
Callback cob 
)

Definition at line 21 of file RoutingDataHandler-inl.h.

Referenced by wangle::RoutingDataHandler< R >::Callback::~Callback().

22  : connId_(connId), cob_(CHECK_NOTNULL(cob)) {}
template<typename R>
wangle::RoutingDataHandler< R >::~RoutingDataHandler ( )
inlineoverride

Definition at line 40 of file RoutingDataHandler.h.

40 {}

Member Function Documentation

template<typename R>
virtual bool wangle::RoutingDataHandler< R >::parseRoutingData ( folly::IOBufQueue bufQueue,
RoutingData routingData 
)
pure virtual

Parse the routing data from bufQueue into routingData. This will be used to compute the hash for choosing the worker thread.

Bytes that need to be passed into the child pipeline (such as additional bytes left in bufQueue not used for parsing) should be moved into RoutingData::bufQueue.

Returns
bool - True on success, false if bufQueue doesn't have sufficient bytes for parsing

Implemented in ClientIPRoutingDataHandler, and NaiveRoutingDataHandler.

Referenced by wangle::RoutingDataHandler< R >::read(), and wangle::RoutingDataHandler< char >::~RoutingDataHandler().

template<typename R >
void wangle::RoutingDataHandler< R >::read ( Context ctx,
folly::IOBufQueue q 
)
override

Definition at line 25 of file RoutingDataHandler-inl.h.

References wangle::RoutingDataHandler< R >::cob_, wangle::RoutingDataHandler< R >::connId_, wangle::RoutingDataHandler< R >::Callback::onRoutingData(), and wangle::RoutingDataHandler< R >::parseRoutingData().

Referenced by wangle::RoutingDataHandler< char >::~RoutingDataHandler().

25  {
26  RoutingData routingData;
27  if (parseRoutingData(q, routingData)) {
28  cob_->onRoutingData(connId_, routingData);
29  }
30 }
virtual bool parseRoutingData(folly::IOBufQueue &bufQueue, RoutingData &routingData)=0
virtual void onRoutingData(uint64_t connId, RoutingData &routingData)=0
template<typename R >
void wangle::RoutingDataHandler< R >::readEOF ( Context ctx)
override

Definition at line 33 of file RoutingDataHandler-inl.h.

References wangle::RoutingDataHandler< R >::cob_, wangle::RoutingDataHandler< R >::connId_, folly::AsyncSocketException::END_OF_FILE, and wangle::RoutingDataHandler< R >::Callback::onError().

Referenced by wangle::RoutingDataHandler< char >::~RoutingDataHandler().

33  {
34  const auto& ex = folly::make_exception_wrapper<folly::AsyncSocketException>(
36  "Received EOF before parsing routing data");
37  cob_->onError(connId_, ex);
38 }
virtual void onError(uint64_t connId, folly::exception_wrapper ex)=0
template<typename R >
void wangle::RoutingDataHandler< R >::readException ( Context ctx,
folly::exception_wrapper  ex 
)
override

Member Data Documentation


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