package compute

import (
	"bytes"
	"context"
	"fmt"
	"github.com/apache/thrift/lib/go/thrift"
	"reflect"
)

var _ = thrift.ZERO
var _ = fmt.Printf
var _ = context.Background
var _ = reflect.DeepEqual
var _ = bytes.Equal

type Result_ struct {
	Div int64 `thrift:"div,1" db:"div" json:"div"`
	Mod int64 `thrift:"mod,2" db:"mod" json:"mod"`
}

func NewResult_() *Result_ {
	return &Result_{}
}

func (p *Result_) GetDiv() int64 {
	return p.Div
}

func (p *Result_) GetMod() int64 {
	return p.Mod
}
func (p *Result_) 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 fieldTypeId == thrift.I64 {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I64 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); 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 *Result_) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.Div = v
	}
	return nil
}

func (p *Result_) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.Mod = v
	}
	return nil
}

func (p *Result_) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("Result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(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 *Result_) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("div", thrift.I64, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:div: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Div)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.div (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:div: ", p), err)
	}
	return err
}

func (p *Result_) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("mod", thrift.I64, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:mod: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Mod)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.mod (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:mod: ", p), err)
	}
	return err
}

func (p *Result_) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("Result_(%+v)", *p)
}

type DivMod interface {

	DoDivMod(ctx context.Context, arg1 int64, arg2 int64) (r *Result_, err error)
}

type DivModClient struct {
	c thrift.TClient
}

func NewDivModClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *DivModClient {
	return &DivModClient{
		c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
	}
}

func NewDivModClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *DivModClient {
	return &DivModClient{
		c: thrift.NewTStandardClient(iprot, oprot),
	}
}

func NewDivModClient(c thrift.TClient) *DivModClient {
	return &DivModClient{
		c: c,
	}
}

func (p *DivModClient) Client_() thrift.TClient {
	return p.c
}

func (p *DivModClient) DoDivMod(ctx context.Context, arg1 int64, arg2 int64) (r *Result_, err error) {
	var _args0 DivModDoDivModArgs
	_args0.Arg1 = arg1
	_args0.Arg2 = arg2
	var _result1 DivModDoDivModResult
	if err = p.Client_().Call(ctx, "DoDivMod", &_args0, &_result1); err != nil {
		return
	}
	return _result1.GetSuccess(), nil
}

type DivModProcessor struct {
	processorMap map[string]thrift.TProcessorFunction
	handler      DivMod
}

func (p *DivModProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
	p.processorMap[key] = processor
}

func (p *DivModProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
	processor, ok = p.processorMap[key]
	return processor, ok
}

func (p *DivModProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
	return p.processorMap
}

func NewDivModProcessor(handler DivMod) *DivModProcessor {

	self2 := &DivModProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
	self2.processorMap["DoDivMod"] = &divModProcessorDoDivMod{handler: handler}
	return self2
}

func (p *DivModProcessor) Process(ctx context.Context, 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(ctx, seqId, iprot, oprot)
	}
	iprot.Skip(thrift.STRUCT)
	iprot.ReadMessageEnd()
	x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
	oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
	x3.Write(oprot)
	oprot.WriteMessageEnd()
	oprot.Flush(ctx)
	return false, x3

}

type divModProcessorDoDivMod struct {
	handler DivMod
}

func (p *divModProcessorDoDivMod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	args := DivModDoDivModArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("DoDivMod", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := DivModDoDivModResult{}
	var retval *Result_
	var err2 error
	if retval, err2 = p.handler.DoDivMod(ctx, args.Arg1, args.Arg2); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing DoDivMod: "+err2.Error())
		oprot.WriteMessageBegin("DoDivMod", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("DoDivMod", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type DivModDoDivModArgs struct {
	Arg1 int64 `thrift:"arg1,1" db:"arg1" json:"arg1"`
	Arg2 int64 `thrift:"arg2,2" db:"arg2" json:"arg2"`
}

func NewDivModDoDivModArgs() *DivModDoDivModArgs {
	return &DivModDoDivModArgs{}
}

func (p *DivModDoDivModArgs) GetArg1() int64 {
	return p.Arg1
}

func (p *DivModDoDivModArgs) GetArg2() int64 {
	return p.Arg2
}
func (p *DivModDoDivModArgs) 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 fieldTypeId == thrift.I64 {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I64 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); 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 *DivModDoDivModArgs) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.Arg1 = v
	}
	return nil
}

func (p *DivModDoDivModArgs) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.Arg2 = v
	}
	return nil
}

func (p *DivModDoDivModArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("DoDivMod_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(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 *DivModDoDivModArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("arg1", thrift.I64, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:arg1: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Arg1)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.arg1 (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:arg1: ", p), err)
	}
	return err
}

func (p *DivModDoDivModArgs) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("arg2", thrift.I64, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:arg2: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Arg2)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.arg2 (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:arg2: ", p), err)
	}
	return err
}

func (p *DivModDoDivModArgs) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("DivModDoDivModArgs(%+v)", *p)
}

type DivModDoDivModResult struct {
	Success *Result_ `thrift:"success,0" db:"success" json:"success,omitempty"`
}

func NewDivModDoDivModResult() *DivModDoDivModResult {
	return &DivModDoDivModResult{}
}

var DivModDoDivModResult_Success_DEFAULT *Result_

func (p *DivModDoDivModResult) GetSuccess() *Result_ {
	if !p.IsSetSuccess() {
		return DivModDoDivModResult_Success_DEFAULT
	}
	return p.Success
}
func (p *DivModDoDivModResult) IsSetSuccess() bool {
	return p.Success != nil
}

func (p *DivModDoDivModResult) 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 0:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField0(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); 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 *DivModDoDivModResult) ReadField0(iprot thrift.TProtocol) error {
	p.Success = &Result_{}
	if err := p.Success.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
	}
	return nil
}

func (p *DivModDoDivModResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("DoDivMod_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField0(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 *DivModDoDivModResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := p.Success.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

func (p *DivModDoDivModResult) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("DivModDoDivModResult(%+v)", *p)
}

type MulRange interface {

	BigRange(ctx context.Context, max int64) (r string, err error)
}

type MulRangeClient struct {
	c thrift.TClient
}

func NewMulRangeClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *MulRangeClient {
	return &MulRangeClient{
		c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
	}
}

func NewMulRangeClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *MulRangeClient {
	return &MulRangeClient{
		c: thrift.NewTStandardClient(iprot, oprot),
	}
}

func NewMulRangeClient(c thrift.TClient) *MulRangeClient {
	return &MulRangeClient{
		c: c,
	}
}

func (p *MulRangeClient) Client_() thrift.TClient {
	return p.c
}

func (p *MulRangeClient) BigRange(ctx context.Context, max int64) (r string, err error) {
	var _args6 MulRangeBigRangeArgs
	_args6.Max = max
	var _result7 MulRangeBigRangeResult
	if err = p.Client_().Call(ctx, "BigRange", &_args6, &_result7); err != nil {
		return
	}
	return _result7.GetSuccess(), nil
}

type MulRangeProcessor struct {
	processorMap map[string]thrift.TProcessorFunction
	handler      MulRange
}

func (p *MulRangeProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
	p.processorMap[key] = processor
}

func (p *MulRangeProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
	processor, ok = p.processorMap[key]
	return processor, ok
}

func (p *MulRangeProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
	return p.processorMap
}

func NewMulRangeProcessor(handler MulRange) *MulRangeProcessor {

	self8 := &MulRangeProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
	self8.processorMap["BigRange"] = &mulRangeProcessorBigRange{handler: handler}
	return self8
}

func (p *MulRangeProcessor) Process(ctx context.Context, 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(ctx, seqId, iprot, oprot)
	}
	iprot.Skip(thrift.STRUCT)
	iprot.ReadMessageEnd()
	x9 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
	oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
	x9.Write(oprot)
	oprot.WriteMessageEnd()
	oprot.Flush(ctx)
	return false, x9

}

type mulRangeProcessorBigRange struct {
	handler MulRange
}

func (p *mulRangeProcessorBigRange) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	args := MulRangeBigRangeArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("BigRange", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := MulRangeBigRangeResult{}
	var retval string
	var err2 error
	if retval, err2 = p.handler.BigRange(ctx, args.Max); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing BigRange: "+err2.Error())
		oprot.WriteMessageBegin("BigRange", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = &retval
	}
	if err2 = oprot.WriteMessageBegin("BigRange", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type MulRangeBigRangeArgs struct {
	Max int64 `thrift:"max,1" db:"max" json:"max"`
}

func NewMulRangeBigRangeArgs() *MulRangeBigRangeArgs {
	return &MulRangeBigRangeArgs{}
}

func (p *MulRangeBigRangeArgs) GetMax() int64 {
	return p.Max
}
func (p *MulRangeBigRangeArgs) 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 fieldTypeId == thrift.I64 {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); 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 *MulRangeBigRangeArgs) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.Max = v
	}
	return nil
}

func (p *MulRangeBigRangeArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("BigRange_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		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 *MulRangeBigRangeArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("max", thrift.I64, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:max: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Max)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.max (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:max: ", p), err)
	}
	return err
}

func (p *MulRangeBigRangeArgs) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("MulRangeBigRangeArgs(%+v)", *p)
}

type MulRangeBigRangeResult struct {
	Success *string `thrift:"success,0" db:"success" json:"success,omitempty"`
}

func NewMulRangeBigRangeResult() *MulRangeBigRangeResult {
	return &MulRangeBigRangeResult{}
}

var MulRangeBigRangeResult_Success_DEFAULT string

func (p *MulRangeBigRangeResult) GetSuccess() string {
	if !p.IsSetSuccess() {
		return MulRangeBigRangeResult_Success_DEFAULT
	}
	return *p.Success
}
func (p *MulRangeBigRangeResult) IsSetSuccess() bool {
	return p.Success != nil
}

func (p *MulRangeBigRangeResult) 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 0:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField0(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); 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 *MulRangeBigRangeResult) ReadField0(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 0: ", err)
	} else {
		p.Success = &v
	}
	return nil
}

func (p *MulRangeBigRangeResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("BigRange_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField0(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 *MulRangeBigRangeResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRING, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := oprot.WriteString(string(*p.Success)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.success (0) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

func (p *MulRangeBigRangeResult) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("MulRangeBigRangeResult(%+v)", *p)
}
// Autogenerated by Thrift Compiler (0.13.0)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING

package compute

import (
	"bytes"
	"context"
	"fmt"
	"github.com/apache/thrift/lib/go/thrift"
	"reflect"
)

// (needed to ensure safety because of naive import list construction.)
var _ = thrift.ZERO
var _ = fmt.Printf
var _ = context.Background
var _ = reflect.DeepEqual
var _ = bytes.Equal

// Attributes:
//  - Div
//  - Mod
type Result_ struct {
	Div int64 `thrift:"div,1" db:"div" json:"div"`
	Mod int64 `thrift:"mod,2" db:"mod" json:"mod"`
}

func NewResult_() *Result_ {
	return &Result_{}
}

func (p *Result_) GetDiv() int64 {
	return p.Div
}

func (p *Result_) GetMod() int64 {
	return p.Mod
}
func (p *Result_) 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 fieldTypeId == thrift.I64 {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I64 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); 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 *Result_) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.Div = v
	}
	return nil
}

func (p *Result_) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.Mod = v
	}
	return nil
}

func (p *Result_) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("Result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(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 *Result_) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("div", thrift.I64, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:div: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Div)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.div (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:div: ", p), err)
	}
	return err
}

func (p *Result_) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("mod", thrift.I64, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:mod: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Mod)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.mod (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:mod: ", p), err)
	}
	return err
}

func (p *Result_) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("Result_(%+v)", *p)
}

type DivMod interface {
	// Parameters:
	//  - Arg1
	//  - Arg2
	DoDivMod(ctx context.Context, arg1 int64, arg2 int64) (r *Result_, err error)
}

type DivModClient struct {
	c thrift.TClient
}

func NewDivModClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *DivModClient {
	return &DivModClient{
		c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
	}
}

func NewDivModClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *DivModClient {
	return &DivModClient{
		c: thrift.NewTStandardClient(iprot, oprot),
	}
}

func NewDivModClient(c thrift.TClient) *DivModClient {
	return &DivModClient{
		c: c,
	}
}

func (p *DivModClient) Client_() thrift.TClient {
	return p.c
}

// Parameters:
//  - Arg1
//  - Arg2
func (p *DivModClient) DoDivMod(ctx context.Context, arg1 int64, arg2 int64) (r *Result_, err error) {
	var _args0 DivModDoDivModArgs
	_args0.Arg1 = arg1
	_args0.Arg2 = arg2
	var _result1 DivModDoDivModResult
	if err = p.Client_().Call(ctx, "DoDivMod", &_args0, &_result1); err != nil {
		return
	}
	return _result1.GetSuccess(), nil
}

type DivModProcessor struct {
	processorMap map[string]thrift.TProcessorFunction
	handler      DivMod
}

func (p *DivModProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
	p.processorMap[key] = processor
}

func (p *DivModProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
	processor, ok = p.processorMap[key]
	return processor, ok
}

func (p *DivModProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
	return p.processorMap
}

func NewDivModProcessor(handler DivMod) *DivModProcessor {

	self2 := &DivModProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
	self2.processorMap["DoDivMod"] = &divModProcessorDoDivMod{handler: handler}
	return self2
}

func (p *DivModProcessor) Process(ctx context.Context, 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(ctx, seqId, iprot, oprot)
	}
	iprot.Skip(thrift.STRUCT)
	iprot.ReadMessageEnd()
	x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
	oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
	x3.Write(oprot)
	oprot.WriteMessageEnd()
	oprot.Flush(ctx)
	return false, x3

}

type divModProcessorDoDivMod struct {
	handler DivMod
}

func (p *divModProcessorDoDivMod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	args := DivModDoDivModArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("DoDivMod", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := DivModDoDivModResult{}
	var retval *Result_
	var err2 error
	if retval, err2 = p.handler.DoDivMod(ctx, args.Arg1, args.Arg2); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing DoDivMod: "+err2.Error())
		oprot.WriteMessageBegin("DoDivMod", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("DoDivMod", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

// HELPER FUNCTIONS AND STRUCTURES

// Attributes:
//  - Arg1
//  - Arg2
type DivModDoDivModArgs struct {
	Arg1 int64 `thrift:"arg1,1" db:"arg1" json:"arg1"`
	Arg2 int64 `thrift:"arg2,2" db:"arg2" json:"arg2"`
}

func NewDivModDoDivModArgs() *DivModDoDivModArgs {
	return &DivModDoDivModArgs{}
}

func (p *DivModDoDivModArgs) GetArg1() int64 {
	return p.Arg1
}

func (p *DivModDoDivModArgs) GetArg2() int64 {
	return p.Arg2
}
func (p *DivModDoDivModArgs) 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 fieldTypeId == thrift.I64 {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I64 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); 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 *DivModDoDivModArgs) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.Arg1 = v
	}
	return nil
}

func (p *DivModDoDivModArgs) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.Arg2 = v
	}
	return nil
}

func (p *DivModDoDivModArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("DoDivMod_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(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 *DivModDoDivModArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("arg1", thrift.I64, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:arg1: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Arg1)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.arg1 (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:arg1: ", p), err)
	}
	return err
}

func (p *DivModDoDivModArgs) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("arg2", thrift.I64, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:arg2: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Arg2)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.arg2 (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:arg2: ", p), err)
	}
	return err
}

func (p *DivModDoDivModArgs) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("DivModDoDivModArgs(%+v)", *p)
}

// Attributes:
//  - Success
type DivModDoDivModResult struct {
	Success *Result_ `thrift:"success,0" db:"success" json:"success,omitempty"`
}

func NewDivModDoDivModResult() *DivModDoDivModResult {
	return &DivModDoDivModResult{}
}

var DivModDoDivModResult_Success_DEFAULT *Result_

func (p *DivModDoDivModResult) GetSuccess() *Result_ {
	if !p.IsSetSuccess() {
		return DivModDoDivModResult_Success_DEFAULT
	}
	return p.Success
}
func (p *DivModDoDivModResult) IsSetSuccess() bool {
	return p.Success != nil
}

func (p *DivModDoDivModResult) 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 0:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField0(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); 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 *DivModDoDivModResult) ReadField0(iprot thrift.TProtocol) error {
	p.Success = &Result_{}
	if err := p.Success.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
	}
	return nil
}

func (p *DivModDoDivModResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("DoDivMod_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField0(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 *DivModDoDivModResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := p.Success.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

func (p *DivModDoDivModResult) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("DivModDoDivModResult(%+v)", *p)
}

type MulRange interface {
	// Parameters:
	//  - Max
	BigRange(ctx context.Context, max int64) (r string, err error)
}

type MulRangeClient struct {
	c thrift.TClient
}

func NewMulRangeClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *MulRangeClient {
	return &MulRangeClient{
		c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
	}
}

func NewMulRangeClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *MulRangeClient {
	return &MulRangeClient{
		c: thrift.NewTStandardClient(iprot, oprot),
	}
}

func NewMulRangeClient(c thrift.TClient) *MulRangeClient {
	return &MulRangeClient{
		c: c,
	}
}

func (p *MulRangeClient) Client_() thrift.TClient {
	return p.c
}

// Parameters:
//  - Max
func (p *MulRangeClient) BigRange(ctx context.Context, max int64) (r string, err error) {
	var _args6 MulRangeBigRangeArgs
	_args6.Max = max
	var _result7 MulRangeBigRangeResult
	if err = p.Client_().Call(ctx, "BigRange", &_args6, &_result7); err != nil {
		return
	}
	return _result7.GetSuccess(), nil
}

type MulRangeProcessor struct {
	processorMap map[string]thrift.TProcessorFunction
	handler      MulRange
}

func (p *MulRangeProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
	p.processorMap[key] = processor
}

func (p *MulRangeProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
	processor, ok = p.processorMap[key]
	return processor, ok
}

func (p *MulRangeProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
	return p.processorMap
}

func NewMulRangeProcessor(handler MulRange) *MulRangeProcessor {

	self8 := &MulRangeProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
	self8.processorMap["BigRange"] = &mulRangeProcessorBigRange{handler: handler}
	return self8
}

func (p *MulRangeProcessor) Process(ctx context.Context, 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(ctx, seqId, iprot, oprot)
	}
	iprot.Skip(thrift.STRUCT)
	iprot.ReadMessageEnd()
	x9 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
	oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
	x9.Write(oprot)
	oprot.WriteMessageEnd()
	oprot.Flush(ctx)
	return false, x9

}

type mulRangeProcessorBigRange struct {
	handler MulRange
}

func (p *mulRangeProcessorBigRange) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	args := MulRangeBigRangeArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("BigRange", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := MulRangeBigRangeResult{}
	var retval string
	var err2 error
	if retval, err2 = p.handler.BigRange(ctx, args.Max); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing BigRange: "+err2.Error())
		oprot.WriteMessageBegin("BigRange", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = &retval
	}
	if err2 = oprot.WriteMessageBegin("BigRange", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

// HELPER FUNCTIONS AND STRUCTURES

// Attributes:
//  - Max
type MulRangeBigRangeArgs struct {
	Max int64 `thrift:"max,1" db:"max" json:"max"`
}

func NewMulRangeBigRangeArgs() *MulRangeBigRangeArgs {
	return &MulRangeBigRangeArgs{}
}

func (p *MulRangeBigRangeArgs) GetMax() int64 {
	return p.Max
}
func (p *MulRangeBigRangeArgs) 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 fieldTypeId == thrift.I64 {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); 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 *MulRangeBigRangeArgs) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.Max = v
	}
	return nil
}

func (p *MulRangeBigRangeArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("BigRange_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		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 *MulRangeBigRangeArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("max", thrift.I64, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:max: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Max)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.max (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:max: ", p), err)
	}
	return err
}

func (p *MulRangeBigRangeArgs) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("MulRangeBigRangeArgs(%+v)", *p)
}

// Attributes:
//  - Success
type MulRangeBigRangeResult struct {
	Success *string `thrift:"success,0" db:"success" json:"success,omitempty"`
}

func NewMulRangeBigRangeResult() *MulRangeBigRangeResult {
	return &MulRangeBigRangeResult{}
}

var MulRangeBigRangeResult_Success_DEFAULT string

func (p *MulRangeBigRangeResult) GetSuccess() string {
	if !p.IsSetSuccess() {
		return MulRangeBigRangeResult_Success_DEFAULT
	}
	return *p.Success
}
func (p *MulRangeBigRangeResult) IsSetSuccess() bool {
	return p.Success != nil
}

func (p *MulRangeBigRangeResult) 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 0:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField0(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); 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 *MulRangeBigRangeResult) ReadField0(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 0: ", err)
	} else {
		p.Success = &v
	}
	return nil
}

func (p *MulRangeBigRangeResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("BigRange_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField0(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 *MulRangeBigRangeResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRING, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := oprot.WriteString(string(*p.Success)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.success (0) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

func (p *MulRangeBigRangeResult) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("MulRangeBigRangeResult(%+v)", *p)
}
