summaryrefslogtreecommitdiff
path: root/vendor/github.com/uber/jaeger-client-go/thrift/protocol.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/uber/jaeger-client-go/thrift/protocol.go')
-rw-r--r--vendor/github.com/uber/jaeger-client-go/thrift/protocol.go148
1 files changed, 75 insertions, 73 deletions
diff --git a/vendor/github.com/uber/jaeger-client-go/thrift/protocol.go b/vendor/github.com/uber/jaeger-client-go/thrift/protocol.go
index 45fa202e7..0a69bd416 100644
--- a/vendor/github.com/uber/jaeger-client-go/thrift/protocol.go
+++ b/vendor/github.com/uber/jaeger-client-go/thrift/protocol.go
@@ -20,7 +20,9 @@
package thrift
import (
+ "context"
"errors"
+ "fmt"
)
const (
@@ -29,51 +31,51 @@ const (
)
type TProtocol interface {
- WriteMessageBegin(name string, typeId TMessageType, seqid int32) error
- WriteMessageEnd() error
- WriteStructBegin(name string) error
- WriteStructEnd() error
- WriteFieldBegin(name string, typeId TType, id int16) error
- WriteFieldEnd() error
- WriteFieldStop() error
- WriteMapBegin(keyType TType, valueType TType, size int) error
- WriteMapEnd() error
- WriteListBegin(elemType TType, size int) error
- WriteListEnd() error
- WriteSetBegin(elemType TType, size int) error
- WriteSetEnd() error
- WriteBool(value bool) error
- WriteByte(value int8) error
- WriteI16(value int16) error
- WriteI32(value int32) error
- WriteI64(value int64) error
- WriteDouble(value float64) error
- WriteString(value string) error
- WriteBinary(value []byte) error
+ WriteMessageBegin(ctx context.Context, name string, typeId TMessageType, seqid int32) error
+ WriteMessageEnd(ctx context.Context) error
+ WriteStructBegin(ctx context.Context, name string) error
+ WriteStructEnd(ctx context.Context) error
+ WriteFieldBegin(ctx context.Context, name string, typeId TType, id int16) error
+ WriteFieldEnd(ctx context.Context) error
+ WriteFieldStop(ctx context.Context) error
+ WriteMapBegin(ctx context.Context, keyType TType, valueType TType, size int) error
+ WriteMapEnd(ctx context.Context) error
+ WriteListBegin(ctx context.Context, elemType TType, size int) error
+ WriteListEnd(ctx context.Context) error
+ WriteSetBegin(ctx context.Context, elemType TType, size int) error
+ WriteSetEnd(ctx context.Context) error
+ WriteBool(ctx context.Context, value bool) error
+ WriteByte(ctx context.Context, value int8) error
+ WriteI16(ctx context.Context, value int16) error
+ WriteI32(ctx context.Context, value int32) error
+ WriteI64(ctx context.Context, value int64) error
+ WriteDouble(ctx context.Context, value float64) error
+ WriteString(ctx context.Context, value string) error
+ WriteBinary(ctx context.Context, value []byte) error
- ReadMessageBegin() (name string, typeId TMessageType, seqid int32, err error)
- ReadMessageEnd() error
- ReadStructBegin() (name string, err error)
- ReadStructEnd() error
- ReadFieldBegin() (name string, typeId TType, id int16, err error)
- ReadFieldEnd() error
- ReadMapBegin() (keyType TType, valueType TType, size int, err error)
- ReadMapEnd() error
- ReadListBegin() (elemType TType, size int, err error)
- ReadListEnd() error
- ReadSetBegin() (elemType TType, size int, err error)
- ReadSetEnd() error
- ReadBool() (value bool, err error)
- ReadByte() (value int8, err error)
- ReadI16() (value int16, err error)
- ReadI32() (value int32, err error)
- ReadI64() (value int64, err error)
- ReadDouble() (value float64, err error)
- ReadString() (value string, err error)
- ReadBinary() (value []byte, err error)
+ ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqid int32, err error)
+ ReadMessageEnd(ctx context.Context) error
+ ReadStructBegin(ctx context.Context) (name string, err error)
+ ReadStructEnd(ctx context.Context) error
+ ReadFieldBegin(ctx context.Context) (name string, typeId TType, id int16, err error)
+ ReadFieldEnd(ctx context.Context) error
+ ReadMapBegin(ctx context.Context) (keyType TType, valueType TType, size int, err error)
+ ReadMapEnd(ctx context.Context) error
+ ReadListBegin(ctx context.Context) (elemType TType, size int, err error)
+ ReadListEnd(ctx context.Context) error
+ ReadSetBegin(ctx context.Context) (elemType TType, size int, err error)
+ ReadSetEnd(ctx context.Context) error
+ ReadBool(ctx context.Context) (value bool, err error)
+ ReadByte(ctx context.Context) (value int8, err error)
+ ReadI16(ctx context.Context) (value int16, err error)
+ ReadI32(ctx context.Context) (value int32, err error)
+ ReadI64(ctx context.Context) (value int64, err error)
+ ReadDouble(ctx context.Context) (value float64, err error)
+ ReadString(ctx context.Context) (value string, err error)
+ ReadBinary(ctx context.Context) (value []byte, err error)
- Skip(fieldType TType) (err error)
- Flush() (err error)
+ Skip(ctx context.Context, fieldType TType) (err error)
+ Flush(ctx context.Context) (err error)
Transport() TTransport
}
@@ -82,94 +84,94 @@ type TProtocol interface {
const DEFAULT_RECURSION_DEPTH = 64
// Skips over the next data element from the provided input TProtocol object.
-func SkipDefaultDepth(prot TProtocol, typeId TType) (err error) {
- return Skip(prot, typeId, DEFAULT_RECURSION_DEPTH)
+func SkipDefaultDepth(ctx context.Context, prot TProtocol, typeId TType) (err error) {
+ return Skip(ctx, prot, typeId, DEFAULT_RECURSION_DEPTH)
}
// Skips over the next data element from the provided input TProtocol object.
-func Skip(self TProtocol, fieldType TType, maxDepth int) (err error) {
-
- if maxDepth <= 0 {
- return NewTProtocolExceptionWithType( DEPTH_LIMIT, errors.New("Depth limit exceeded"))
+func Skip(ctx context.Context, self TProtocol, fieldType TType, maxDepth int) (err error) {
+
+ if maxDepth <= 0 {
+ return NewTProtocolExceptionWithType(DEPTH_LIMIT, errors.New("Depth limit exceeded"))
}
switch fieldType {
- case STOP:
- return
case BOOL:
- _, err = self.ReadBool()
+ _, err = self.ReadBool(ctx)
return
case BYTE:
- _, err = self.ReadByte()
+ _, err = self.ReadByte(ctx)
return
case I16:
- _, err = self.ReadI16()
+ _, err = self.ReadI16(ctx)
return
case I32:
- _, err = self.ReadI32()
+ _, err = self.ReadI32(ctx)
return
case I64:
- _, err = self.ReadI64()
+ _, err = self.ReadI64(ctx)
return
case DOUBLE:
- _, err = self.ReadDouble()
+ _, err = self.ReadDouble(ctx)
return
case STRING:
- _, err = self.ReadString()
+ _, err = self.ReadString(ctx)
return
case STRUCT:
- if _, err = self.ReadStructBegin(); err != nil {
+ if _, err = self.ReadStructBegin(ctx); err != nil {
return err
}
for {
- _, typeId, _, _ := self.ReadFieldBegin()
+ _, typeId, _, _ := self.ReadFieldBegin(ctx)
if typeId == STOP {
break
}
- err := Skip(self, typeId, maxDepth-1)
+ err := Skip(ctx, self, typeId, maxDepth-1)
if err != nil {
return err
}
- self.ReadFieldEnd()
+ self.ReadFieldEnd(ctx)
}
- return self.ReadStructEnd()
+ return self.ReadStructEnd(ctx)
case MAP:
- keyType, valueType, size, err := self.ReadMapBegin()
+ keyType, valueType, size, err := self.ReadMapBegin(ctx)
if err != nil {
return err
}
for i := 0; i < size; i++ {
- err := Skip(self, keyType, maxDepth-1)
+ err := Skip(ctx, self, keyType, maxDepth-1)
if err != nil {
return err
}
- self.Skip(valueType)
+ self.Skip(ctx, valueType)
}
- return self.ReadMapEnd()
+ return self.ReadMapEnd(ctx)
case SET:
- elemType, size, err := self.ReadSetBegin()
+ elemType, size, err := self.ReadSetBegin(ctx)
if err != nil {
return err
}
for i := 0; i < size; i++ {
- err := Skip(self, elemType, maxDepth-1)
+ err := Skip(ctx, self, elemType, maxDepth-1)
if err != nil {
return err
}
}
- return self.ReadSetEnd()
+ return self.ReadSetEnd(ctx)
case LIST:
- elemType, size, err := self.ReadListBegin()
+ elemType, size, err := self.ReadListBegin(ctx)
if err != nil {
return err
}
for i := 0; i < size; i++ {
- err := Skip(self, elemType, maxDepth-1)
+ err := Skip(ctx, self, elemType, maxDepth-1)
if err != nil {
return err
}
}
- return self.ReadListEnd()
+ return self.ReadListEnd(ctx)
+ default:
+ return NewTProtocolExceptionWithType(INVALID_DATA, errors.New(fmt.Sprintf("Unknown data type %d", fieldType)))
}
return nil
}