proxygen
ClientSerializeHandler Class Reference

#include <ClientSerializeHandler.h>

Inheritance diagram for ClientSerializeHandler:
wangle::Handler< std::unique_ptr< folly::IOBuf >, thrift::test::Xtruct, thrift::test::Bonk, std::unique_ptr< folly::IOBuf > > wangle::HandlerBase< HandlerContext< thrift::test::Xtruct, std::unique_ptr< folly::IOBuf > > >

Public Member Functions

void read (Context *ctx, std::unique_ptr< folly::IOBuf > msg) override
 
folly::Future< folly::Unitwrite (Context *ctx, thrift::test::Bonk b) override
 
- Public Member Functions inherited from wangle::Handler< std::unique_ptr< folly::IOBuf >, thrift::test::Xtruct, thrift::test::Bonk, std::unique_ptr< folly::IOBuf > >
 ~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< thrift::test::Xtruct, std::unique_ptr< folly::IOBuf > > >
virtual ~HandlerBase ()=default
 
virtual void attachPipeline (HandlerContext< thrift::test::Xtruct, std::unique_ptr< folly::IOBuf > > *)
 
virtual void detachPipeline (HandlerContext< thrift::test::Xtruct, std::unique_ptr< folly::IOBuf > > *)
 
HandlerContext< thrift::test::Xtruct, std::unique_ptr< folly::IOBuf > > * getContext ()
 

Additional Inherited Members

- Public Types inherited from wangle::Handler< std::unique_ptr< folly::IOBuf >, thrift::test::Xtruct, thrift::test::Bonk, std::unique_ptr< folly::IOBuf > >
typedef std::unique_ptr< folly::IOBufrin
 
typedef thrift::test::Xtruct rout
 
typedef thrift::test::Bonk win
 
typedef std::unique_ptr< folly::IOBufwout
 
typedef HandlerContext< thrift::test::Xtruct, std::unique_ptr< folly::IOBuf > > Context
 
- Static Public Attributes inherited from wangle::Handler< std::unique_ptr< folly::IOBuf >, thrift::test::Xtruct, thrift::test::Bonk, std::unique_ptr< folly::IOBuf > >
static const HandlerDir dir
 

Detailed Description

Definition at line 25 of file ClientSerializeHandler.h.

Member Function Documentation

void ClientSerializeHandler::read ( Context ctx,
std::unique_ptr< folly::IOBuf msg 
)
inlineoverridevirtual

Implements wangle::Handler< std::unique_ptr< folly::IOBuf >, thrift::test::Xtruct, thrift::test::Bonk, std::unique_ptr< folly::IOBuf > >.

Definition at line 29 of file ClientSerializeHandler.h.

References wangle::HandlerContext< In, Out >::fireRead().

29  {
30  thrift::test::Xtruct received =
31  apache::thrift::CompactSerializer::deserialize<thrift::test::Xtruct>(
32  msg.get());
33  ctx->fireRead(received);
34  }
folly::Future<folly::Unit> ClientSerializeHandler::write ( Context ctx,
thrift::test::Bonk  b 
)
inlineoverridevirtual

Implements wangle::Handler< std::unique_ptr< folly::IOBuf >, thrift::test::Xtruct, thrift::test::Bonk, std::unique_ptr< folly::IOBuf > >.

Definition at line 36 of file ClientSerializeHandler.h.

References folly::IOBuf::copyBuffer(), wangle::HandlerContext< In, Out >::fireWrite(), folly::json::serialize(), and string.

37  {
38  std::string out;
40  return ctx->fireWrite(folly::IOBuf::copyBuffer(out));
41  }
char b
const char * string
Definition: Conv.cpp:212
std::string serialize(dynamic const &dyn, serialization_opts const &opts)
Definition: json.cpp:621
static std::unique_ptr< IOBuf > copyBuffer(const void *buf, std::size_t size, std::size_t headroom=0, std::size_t minTailroom=0)
Definition: IOBuf.h:1587

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