// Autogenerated by Thrift Compiler (0.9.3) // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING package v2 import ( "bytes" "fmt" "github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift" ) // (needed to ensure safety because of naive import list construction.) var _ = thrift.ZERO var _ = fmt.Printf var _ = bytes.Equal type M3 interface { // Parameters: // - Batch EmitMetricBatchV2(batch MetricBatch) (err error) } type M3Client struct { Transport thrift.TTransport ProtocolFactory thrift.TProtocolFactory InputProtocol thrift.TProtocol OutputProtocol thrift.TProtocol SeqId int32 } func NewM3ClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *M3Client { return &M3Client{Transport: t, ProtocolFactory: f, InputProtocol: f.GetProtocol(t), OutputProtocol: f.GetProtocol(t), SeqId: 0, } } func NewM3ClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *M3Client { return &M3Client{Transport: t, ProtocolFactory: nil, InputProtocol: iprot, OutputProtocol: oprot, SeqId: 0, } } // Parameters: // - Batch func (p *M3Client) EmitMetricBatchV2(batch MetricBatch) (err error) { if err = p.sendEmitMetricBatchV2(batch); err != nil { return } return } func (p *M3Client) sendEmitMetricBatchV2(batch MetricBatch) (err error) { oprot := p.OutputProtocol if oprot == nil { oprot = p.ProtocolFactory.GetProtocol(p.Transport) p.OutputProtocol = oprot } p.SeqId++ if err = oprot.WriteMessageBegin("emitMetricBatchV2", thrift.ONEWAY, p.SeqId); err != nil { return } args := M3EmitMetricBatchV2Args{ Batch: batch, } if err = args.Write(oprot); err != nil { return } if err = oprot.WriteMessageEnd(); err != nil { return } return oprot.Flush() } type M3Processor struct { processorMap map[string]thrift.TProcessorFunction handler M3 } func (p *M3Processor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { p.processorMap[key] = processor } func (p *M3Processor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { processor, ok = p.processorMap[key] return processor, ok } func (p *M3Processor) ProcessorMap() map[string]thrift.TProcessorFunction { return p.processorMap } func NewM3Processor(handler M3) *M3Processor { self3 := &M3Processor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} self3.processorMap["emitMetricBatchV2"] = &m3ProcessorEmitMetricBatchV2{handler: handler} return self3 } func (p *M3Processor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { name, _, seqId, err := iprot.ReadMessageBegin() if err != nil { return false, err } if processor, ok := p.GetProcessorFunction(name); ok { return processor.Process(seqId, iprot, oprot) } iprot.Skip(thrift.STRUCT) iprot.ReadMessageEnd() x4 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) x4.Write(oprot) oprot.WriteMessageEnd() oprot.Flush() return false, x4 } type m3ProcessorEmitMetricBatchV2 struct { handler M3 } func (p *m3ProcessorEmitMetricBatchV2) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := M3EmitMetricBatchV2Args{} if err = args.Read(iprot); err != nil { iprot.ReadMessageEnd() return false, err } iprot.ReadMessageEnd() var err2 error if err2 = p.handler.EmitMetricBatchV2(args.Batch); err2 != nil { return true, err2 } return true, nil } // HELPER FUNCTIONS AND STRUCTURES // Attributes: // - Batch type M3EmitMetricBatchV2Args struct { Batch MetricBatch `thrift:"batch,1" json:"batch"` } func NewM3EmitMetricBatchV2Args() *M3EmitMetricBatchV2Args { return &M3EmitMetricBatchV2Args{} } var M3EmitMetricBatchV2Args_Batch_DEFAULT MetricBatch func (p *M3EmitMetricBatchV2Args) GetBatch() MetricBatch { if !p.IsSetBatch() { return M3EmitMetricBatchV2Args_Batch_DEFAULT } return p.Batch } func (p *M3EmitMetricBatchV2Args) IsSetBatch() bool { return p.Batch.Metrics != nil || p.Batch.CommonTags != nil } func (p *M3EmitMetricBatchV2Args) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break } switch fieldId { case 1: if err := p.readField1(iprot); err != nil { return err } default: if err := iprot.Skip(fieldTypeId); err != nil { return err } } if err := iprot.ReadFieldEnd(); err != nil { return err } } if err := iprot.ReadStructEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } func (p *M3EmitMetricBatchV2Args) readField1(iprot thrift.TProtocol) error { p.Batch = MetricBatch{} if err := p.Batch.Read(iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Batch), err) } return nil } func (p *M3EmitMetricBatchV2Args) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("emitMetricBatchV2_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if err := p.writeField1(oprot); err != nil { return err } if err := oprot.WriteFieldStop(); err != nil { return thrift.PrependError("write field stop error: ", err) } if err := oprot.WriteStructEnd(); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } func (p *M3EmitMetricBatchV2Args) writeField1(oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin("batch", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batch: ", p), err) } if err := p.Batch.Write(oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Batch), err) } if err := oprot.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batch: ", p), err) } return err } func (p *M3EmitMetricBatchV2Args) String() string { if p == nil { return "" } return fmt.Sprintf("M3EmitMetricBatchV2Args(%+v)", *p) }