Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
175 lines (144 sloc) 5.31 KB
/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
#include "SpanReceiver.h"
namespace accumulo { namespace cloudtrace {
uint32_t SpanReceiver_span_args::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->span.read(iprot);
this->__isset.span = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t SpanReceiver_span_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("SpanReceiver_span_args");
xfer += oprot->writeFieldBegin("span", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->span.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
uint32_t SpanReceiver_span_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("SpanReceiver_span_pargs");
xfer += oprot->writeFieldBegin("span", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->span)).write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void SpanReceiverClient::span(const RemoteSpan& span)
{
send_span(span);
}
void SpanReceiverClient::send_span(const RemoteSpan& span)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin("span", ::apache::thrift::protocol::T_CALL, cseqid);
SpanReceiver_span_pargs args;
args.span = &span;
args.write(oprot_);
oprot_->writeMessageEnd();
oprot_->getTransport()->writeEnd();
oprot_->getTransport()->flush();
}
bool SpanReceiverProcessor::process(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot, void* callContext) {
::apache::thrift::protocol::TProtocol* iprot = piprot.get();
::apache::thrift::protocol::TProtocol* oprot = poprot.get();
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
int32_t seqid;
iprot->readMessageBegin(fname, mtype, seqid);
if (mtype != ::apache::thrift::protocol::T_CALL && mtype != ::apache::thrift::protocol::T_ONEWAY) {
iprot->skip(::apache::thrift::protocol::T_STRUCT);
iprot->readMessageEnd();
iprot->getTransport()->readEnd();
::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::INVALID_MESSAGE_TYPE);
oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write(oprot);
oprot->writeMessageEnd();
oprot->getTransport()->writeEnd();
oprot->getTransport()->flush();
return true;
}
return process_fn(iprot, oprot, fname, seqid, callContext);
}
bool SpanReceiverProcessor::process_fn(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, std::string& fname, int32_t seqid, void* callContext) {
std::map<std::string, void (SpanReceiverProcessor::*)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*)>::iterator pfn;
pfn = processMap_.find(fname);
if (pfn == processMap_.end()) {
iprot->skip(::apache::thrift::protocol::T_STRUCT);
iprot->readMessageEnd();
iprot->getTransport()->readEnd();
::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'");
oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write(oprot);
oprot->writeMessageEnd();
oprot->getTransport()->writeEnd();
oprot->getTransport()->flush();
return true;
}
(this->*(pfn->second))(seqid, iprot, oprot, callContext);
return true;
}
void SpanReceiverProcessor::process_span(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (eventHandler_.get() != NULL) {
ctx = eventHandler_->getContext("SpanReceiver.span", callContext);
}
::apache::thrift::TProcessorContextFreer freer(eventHandler_.get(), ctx, "SpanReceiver.span");
if (eventHandler_.get() != NULL) {
eventHandler_->preRead(ctx, "SpanReceiver.span");
}
SpanReceiver_span_args args;
args.read(iprot);
iprot->readMessageEnd();
uint32_t bytes = iprot->getTransport()->readEnd();
if (eventHandler_.get() != NULL) {
eventHandler_->postRead(ctx, "SpanReceiver.span", bytes);
}
try {
iface_->span(args.span);
} catch (const std::exception& e) {
if (eventHandler_.get() != NULL) {
eventHandler_->handlerError(ctx, "SpanReceiver.span");
}
return;
}
if (eventHandler_.get() != NULL) {
eventHandler_->asyncComplete(ctx, "SpanReceiver.span");
}
return;
}
}} // namespace