proxygen
ServerSerializeHandler Class Reference

#include <ServerSerializeHandler.h>

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

Additional Inherited Members

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

Detailed Description

Definition at line 25 of file ServerSerializeHandler.h.

Member Function Documentation

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

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

Definition at line 29 of file ServerSerializeHandler.h.

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

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

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

Definition at line 36 of file ServerSerializeHandler.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: