THRIFT-5233: Handle I/O timeouts in go library
Client: go
As discussed in the JIRA ticket, this commit changes how we handle I/O
timeouts in the go library.
This is a breaking change that adds context to all Read*, Write*, and
Skip functions to TProtocol, along with the compiler change to support
that, and also adds context to TStandardClient.Recv, TDeserializer,
TStruct, and a few others.
Along with the function signature changes, this commit also implements
context cancellation check in the following TProtocol's ReadMessageBegin
implementations:
- TBinaryProtocol
- TCompactProtocol
- THeaderProtocol
In those ReadMessageBegin implementations, if the passed in context
object has a deadline attached, it will keep retrying the I/O timeout
errors, until the deadline on the context object passed. They won't
retry I/O timeout errors if the passed in context does not have a
deadline attached (still return on the first error).
diff --git a/lib/go/test/tests/client_error_test.go b/lib/go/test/tests/client_error_test.go
index fdec4ea..a064163 100644
--- a/lib/go/test/tests/client_error_test.go
+++ b/lib/go/test/tests/client_error_test.go
@@ -37,84 +37,84 @@
if failAt == 0 {
err = failWith
}
- last := protocol.EXPECT().WriteMessageBegin("testStruct", thrift.CALL, int32(1)).Return(err)
+ last := protocol.EXPECT().WriteMessageBegin(context.Background(), "testStruct", thrift.CALL, int32(1)).Return(err)
if failAt == 0 {
return true
}
if failAt == 1 {
err = failWith
}
- last = protocol.EXPECT().WriteStructBegin("testStruct_args").Return(err).After(last)
+ last = protocol.EXPECT().WriteStructBegin(context.Background(), "testStruct_args").Return(err).After(last)
if failAt == 1 {
return true
}
if failAt == 2 {
err = failWith
}
- last = protocol.EXPECT().WriteFieldBegin("thing", thrift.TType(thrift.STRUCT), int16(1)).Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldBegin(context.Background(), "thing", thrift.TType(thrift.STRUCT), int16(1)).Return(err).After(last)
if failAt == 2 {
return true
}
if failAt == 3 {
err = failWith
}
- last = protocol.EXPECT().WriteStructBegin("TestStruct").Return(err).After(last)
+ last = protocol.EXPECT().WriteStructBegin(context.Background(), "TestStruct").Return(err).After(last)
if failAt == 3 {
return true
}
if failAt == 4 {
err = failWith
}
- last = protocol.EXPECT().WriteFieldBegin("m", thrift.TType(thrift.MAP), int16(1)).Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldBegin(context.Background(), "m", thrift.TType(thrift.MAP), int16(1)).Return(err).After(last)
if failAt == 4 {
return true
}
if failAt == 5 {
err = failWith
}
- last = protocol.EXPECT().WriteMapBegin(thrift.TType(thrift.STRING), thrift.TType(thrift.STRING), 0).Return(err).After(last)
+ last = protocol.EXPECT().WriteMapBegin(context.Background(), thrift.TType(thrift.STRING), thrift.TType(thrift.STRING), 0).Return(err).After(last)
if failAt == 5 {
return true
}
if failAt == 6 {
err = failWith
}
- last = protocol.EXPECT().WriteMapEnd().Return(err).After(last)
+ last = protocol.EXPECT().WriteMapEnd(context.Background()).Return(err).After(last)
if failAt == 6 {
return true
}
if failAt == 7 {
err = failWith
}
- last = protocol.EXPECT().WriteFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldEnd(context.Background()).Return(err).After(last)
if failAt == 7 {
return true
}
if failAt == 8 {
err = failWith
}
- last = protocol.EXPECT().WriteFieldBegin("l", thrift.TType(thrift.LIST), int16(2)).Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldBegin(context.Background(), "l", thrift.TType(thrift.LIST), int16(2)).Return(err).After(last)
if failAt == 8 {
return true
}
if failAt == 9 {
err = failWith
}
- last = protocol.EXPECT().WriteListBegin(thrift.TType(thrift.STRING), 0).Return(err).After(last)
+ last = protocol.EXPECT().WriteListBegin(context.Background(), thrift.TType(thrift.STRING), 0).Return(err).After(last)
if failAt == 9 {
return true
}
if failAt == 10 {
err = failWith
}
- last = protocol.EXPECT().WriteListEnd().Return(err).After(last)
+ last = protocol.EXPECT().WriteListEnd(context.Background()).Return(err).After(last)
if failAt == 10 {
return true
}
if failAt == 11 {
err = failWith
}
- last = protocol.EXPECT().WriteFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldEnd(context.Background()).Return(err).After(last)
if failAt == 11 {
return true
}
@@ -122,91 +122,91 @@
err = failWith
}
- last = protocol.EXPECT().WriteFieldBegin("s", thrift.TType(thrift.SET), int16(3)).Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldBegin(context.Background(), "s", thrift.TType(thrift.SET), int16(3)).Return(err).After(last)
if failAt == 12 {
return true
}
if failAt == 13 {
err = failWith
}
- last = protocol.EXPECT().WriteSetBegin(thrift.TType(thrift.STRING), 0).Return(err).After(last)
+ last = protocol.EXPECT().WriteSetBegin(context.Background(), thrift.TType(thrift.STRING), 0).Return(err).After(last)
if failAt == 13 {
return true
}
if failAt == 14 {
err = failWith
}
- last = protocol.EXPECT().WriteSetEnd().Return(err).After(last)
+ last = protocol.EXPECT().WriteSetEnd(context.Background()).Return(err).After(last)
if failAt == 14 {
return true
}
if failAt == 15 {
err = failWith
}
- last = protocol.EXPECT().WriteFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldEnd(context.Background()).Return(err).After(last)
if failAt == 15 {
return true
}
if failAt == 16 {
err = failWith
}
- last = protocol.EXPECT().WriteFieldBegin("i", thrift.TType(thrift.I32), int16(4)).Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldBegin(context.Background(), "i", thrift.TType(thrift.I32), int16(4)).Return(err).After(last)
if failAt == 16 {
return true
}
if failAt == 17 {
err = failWith
}
- last = protocol.EXPECT().WriteI32(int32(3)).Return(err).After(last)
+ last = protocol.EXPECT().WriteI32(context.Background(), int32(3)).Return(err).After(last)
if failAt == 17 {
return true
}
if failAt == 18 {
err = failWith
}
- last = protocol.EXPECT().WriteFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldEnd(context.Background()).Return(err).After(last)
if failAt == 18 {
return true
}
if failAt == 19 {
err = failWith
}
- last = protocol.EXPECT().WriteFieldStop().Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldStop(context.Background()).Return(err).After(last)
if failAt == 19 {
return true
}
if failAt == 20 {
err = failWith
}
- last = protocol.EXPECT().WriteStructEnd().Return(err).After(last)
+ last = protocol.EXPECT().WriteStructEnd(context.Background()).Return(err).After(last)
if failAt == 20 {
return true
}
if failAt == 21 {
err = failWith
}
- last = protocol.EXPECT().WriteFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldEnd(context.Background()).Return(err).After(last)
if failAt == 21 {
return true
}
if failAt == 22 {
err = failWith
}
- last = protocol.EXPECT().WriteFieldStop().Return(err).After(last)
+ last = protocol.EXPECT().WriteFieldStop(context.Background()).Return(err).After(last)
if failAt == 22 {
return true
}
if failAt == 23 {
err = failWith
}
- last = protocol.EXPECT().WriteStructEnd().Return(err).After(last)
+ last = protocol.EXPECT().WriteStructEnd(context.Background()).Return(err).After(last)
if failAt == 23 {
return true
}
if failAt == 24 {
err = failWith
}
- last = protocol.EXPECT().WriteMessageEnd().Return(err).After(last)
+ last = protocol.EXPECT().WriteMessageEnd(context.Background()).Return(err).After(last)
if failAt == 24 {
return true
}
@@ -220,175 +220,175 @@
if failAt == 26 {
err = failWith
}
- last = protocol.EXPECT().ReadMessageBegin().Return("testStruct", thrift.REPLY, int32(1), err).After(last)
+ last = protocol.EXPECT().ReadMessageBegin(context.Background()).Return("testStruct", thrift.REPLY, int32(1), err).After(last)
if failAt == 26 {
return true
}
if failAt == 27 {
err = failWith
}
- last = protocol.EXPECT().ReadStructBegin().Return("testStruct_args", err).After(last)
+ last = protocol.EXPECT().ReadStructBegin(context.Background()).Return("testStruct_args", err).After(last)
if failAt == 27 {
return true
}
if failAt == 28 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldBegin().Return("_", thrift.TType(thrift.STRUCT), int16(0), err).After(last)
+ last = protocol.EXPECT().ReadFieldBegin(context.Background()).Return("_", thrift.TType(thrift.STRUCT), int16(0), err).After(last)
if failAt == 28 {
return true
}
if failAt == 29 {
err = failWith
}
- last = protocol.EXPECT().ReadStructBegin().Return("TestStruct", err).After(last)
+ last = protocol.EXPECT().ReadStructBegin(context.Background()).Return("TestStruct", err).After(last)
if failAt == 29 {
return true
}
if failAt == 30 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldBegin().Return("m", thrift.TType(thrift.MAP), int16(1), err).After(last)
+ last = protocol.EXPECT().ReadFieldBegin(context.Background()).Return("m", thrift.TType(thrift.MAP), int16(1), err).After(last)
if failAt == 30 {
return true
}
if failAt == 31 {
err = failWith
}
- last = protocol.EXPECT().ReadMapBegin().Return(thrift.TType(thrift.STRING), thrift.TType(thrift.STRING), 0, err).After(last)
+ last = protocol.EXPECT().ReadMapBegin(context.Background()).Return(thrift.TType(thrift.STRING), thrift.TType(thrift.STRING), 0, err).After(last)
if failAt == 31 {
return true
}
if failAt == 32 {
err = failWith
}
- last = protocol.EXPECT().ReadMapEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadMapEnd(context.Background()).Return(err).After(last)
if failAt == 32 {
return true
}
if failAt == 33 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadFieldEnd(context.Background()).Return(err).After(last)
if failAt == 33 {
return true
}
if failAt == 34 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldBegin().Return("l", thrift.TType(thrift.LIST), int16(2), err).After(last)
+ last = protocol.EXPECT().ReadFieldBegin(context.Background()).Return("l", thrift.TType(thrift.LIST), int16(2), err).After(last)
if failAt == 34 {
return true
}
if failAt == 35 {
err = failWith
}
- last = protocol.EXPECT().ReadListBegin().Return(thrift.TType(thrift.STRING), 0, err).After(last)
+ last = protocol.EXPECT().ReadListBegin(context.Background()).Return(thrift.TType(thrift.STRING), 0, err).After(last)
if failAt == 35 {
return true
}
if failAt == 36 {
err = failWith
}
- last = protocol.EXPECT().ReadListEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadListEnd(context.Background()).Return(err).After(last)
if failAt == 36 {
return true
}
if failAt == 37 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadFieldEnd(context.Background()).Return(err).After(last)
if failAt == 37 {
return true
}
if failAt == 38 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldBegin().Return("s", thrift.TType(thrift.SET), int16(3), err).After(last)
+ last = protocol.EXPECT().ReadFieldBegin(context.Background()).Return("s", thrift.TType(thrift.SET), int16(3), err).After(last)
if failAt == 38 {
return true
}
if failAt == 39 {
err = failWith
}
- last = protocol.EXPECT().ReadSetBegin().Return(thrift.TType(thrift.STRING), 0, err).After(last)
+ last = protocol.EXPECT().ReadSetBegin(context.Background()).Return(thrift.TType(thrift.STRING), 0, err).After(last)
if failAt == 39 {
return true
}
if failAt == 40 {
err = failWith
}
- last = protocol.EXPECT().ReadSetEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadSetEnd(context.Background()).Return(err).After(last)
if failAt == 40 {
return true
}
if failAt == 41 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadFieldEnd(context.Background()).Return(err).After(last)
if failAt == 41 {
return true
}
if failAt == 42 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldBegin().Return("i", thrift.TType(thrift.I32), int16(4), err).After(last)
+ last = protocol.EXPECT().ReadFieldBegin(context.Background()).Return("i", thrift.TType(thrift.I32), int16(4), err).After(last)
if failAt == 42 {
return true
}
if failAt == 43 {
err = failWith
}
- last = protocol.EXPECT().ReadI32().Return(int32(3), err).After(last)
+ last = protocol.EXPECT().ReadI32(context.Background()).Return(int32(3), err).After(last)
if failAt == 43 {
return true
}
if failAt == 44 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadFieldEnd(context.Background()).Return(err).After(last)
if failAt == 44 {
return true
}
if failAt == 45 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldBegin().Return("_", thrift.TType(thrift.STOP), int16(5), err).After(last)
+ last = protocol.EXPECT().ReadFieldBegin(context.Background()).Return("_", thrift.TType(thrift.STOP), int16(5), err).After(last)
if failAt == 45 {
return true
}
if failAt == 46 {
err = failWith
}
- last = protocol.EXPECT().ReadStructEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadStructEnd(context.Background()).Return(err).After(last)
if failAt == 46 {
return true
}
if failAt == 47 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadFieldEnd(context.Background()).Return(err).After(last)
if failAt == 47 {
return true
}
if failAt == 48 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldBegin().Return("_", thrift.TType(thrift.STOP), int16(1), err).After(last)
+ last = protocol.EXPECT().ReadFieldBegin(context.Background()).Return("_", thrift.TType(thrift.STOP), int16(1), err).After(last)
if failAt == 48 {
return true
}
if failAt == 49 {
err = failWith
}
- last = protocol.EXPECT().ReadStructEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadStructEnd(context.Background()).Return(err).After(last)
if failAt == 49 {
return true
}
if failAt == 50 {
err = failWith
}
- last = protocol.EXPECT().ReadMessageEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadMessageEnd(context.Background()).Return(err).After(last)
if failAt == 50 {
return true
}
@@ -529,91 +529,91 @@
var err error = nil
// No need to test failure in this block, because it is covered in other test cases
- last := protocol.EXPECT().WriteMessageBegin("testString", thrift.CALL, int32(1))
- last = protocol.EXPECT().WriteStructBegin("testString_args").After(last)
- last = protocol.EXPECT().WriteFieldBegin("s", thrift.TType(thrift.STRING), int16(1)).After(last)
- last = protocol.EXPECT().WriteString("test").After(last)
- last = protocol.EXPECT().WriteFieldEnd().After(last)
- last = protocol.EXPECT().WriteFieldStop().After(last)
- last = protocol.EXPECT().WriteStructEnd().After(last)
- last = protocol.EXPECT().WriteMessageEnd().After(last)
+ last := protocol.EXPECT().WriteMessageBegin(context.Background(), "testString", thrift.CALL, int32(1))
+ last = protocol.EXPECT().WriteStructBegin(context.Background(), "testString_args").After(last)
+ last = protocol.EXPECT().WriteFieldBegin(context.Background(), "s", thrift.TType(thrift.STRING), int16(1)).After(last)
+ last = protocol.EXPECT().WriteString(context.Background(), "test").After(last)
+ last = protocol.EXPECT().WriteFieldEnd(context.Background()).After(last)
+ last = protocol.EXPECT().WriteFieldStop(context.Background()).After(last)
+ last = protocol.EXPECT().WriteStructEnd(context.Background()).After(last)
+ last = protocol.EXPECT().WriteMessageEnd(context.Background()).After(last)
last = protocol.EXPECT().Flush(context.Background()).After(last)
// Reading the exception, might fail.
if failAt == 0 {
err = failWith
}
- last = protocol.EXPECT().ReadMessageBegin().Return("testString", thrift.EXCEPTION, int32(1), err).After(last)
+ last = protocol.EXPECT().ReadMessageBegin(context.Background()).Return("testString", thrift.EXCEPTION, int32(1), err).After(last)
if failAt == 0 {
return true
}
if failAt == 1 {
err = failWith
}
- last = protocol.EXPECT().ReadStructBegin().Return("TApplicationException", err).After(last)
+ last = protocol.EXPECT().ReadStructBegin(context.Background()).Return("TApplicationException", err).After(last)
if failAt == 1 {
return true
}
if failAt == 2 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldBegin().Return("message", thrift.TType(thrift.STRING), int16(1), err).After(last)
+ last = protocol.EXPECT().ReadFieldBegin(context.Background()).Return("message", thrift.TType(thrift.STRING), int16(1), err).After(last)
if failAt == 2 {
return true
}
if failAt == 3 {
err = failWith
}
- last = protocol.EXPECT().ReadString().Return("test", err).After(last)
+ last = protocol.EXPECT().ReadString(context.Background()).Return("test", err).After(last)
if failAt == 3 {
return true
}
if failAt == 4 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadFieldEnd(context.Background()).Return(err).After(last)
if failAt == 4 {
return true
}
if failAt == 5 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldBegin().Return("type", thrift.TType(thrift.I32), int16(2), err).After(last)
+ last = protocol.EXPECT().ReadFieldBegin(context.Background()).Return("type", thrift.TType(thrift.I32), int16(2), err).After(last)
if failAt == 5 {
return true
}
if failAt == 6 {
err = failWith
}
- last = protocol.EXPECT().ReadI32().Return(int32(thrift.PROTOCOL_ERROR), err).After(last)
+ last = protocol.EXPECT().ReadI32(context.Background()).Return(int32(thrift.PROTOCOL_ERROR), err).After(last)
if failAt == 6 {
return true
}
if failAt == 7 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadFieldEnd(context.Background()).Return(err).After(last)
if failAt == 7 {
return true
}
if failAt == 8 {
err = failWith
}
- last = protocol.EXPECT().ReadFieldBegin().Return("_", thrift.TType(thrift.STOP), int16(2), err).After(last)
+ last = protocol.EXPECT().ReadFieldBegin(context.Background()).Return("_", thrift.TType(thrift.STOP), int16(2), err).After(last)
if failAt == 8 {
return true
}
if failAt == 9 {
err = failWith
}
- last = protocol.EXPECT().ReadStructEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadStructEnd(context.Background()).Return(err).After(last)
if failAt == 9 {
return true
}
if failAt == 10 {
err = failWith
}
- last = protocol.EXPECT().ReadMessageEnd().Return(err).After(last)
+ last = protocol.EXPECT().ReadMessageEnd(context.Background()).Return(err).After(last)
if failAt == 10 {
return true
}
@@ -697,16 +697,16 @@
mockCtrl := gomock.NewController(t)
protocol := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- protocol.EXPECT().WriteMessageBegin("testString", thrift.CALL, int32(1)),
- protocol.EXPECT().WriteStructBegin("testString_args"),
- protocol.EXPECT().WriteFieldBegin("s", thrift.TType(thrift.STRING), int16(1)),
- protocol.EXPECT().WriteString("test"),
- protocol.EXPECT().WriteFieldEnd(),
- protocol.EXPECT().WriteFieldStop(),
- protocol.EXPECT().WriteStructEnd(),
- protocol.EXPECT().WriteMessageEnd(),
+ protocol.EXPECT().WriteMessageBegin(context.Background(), "testString", thrift.CALL, int32(1)),
+ protocol.EXPECT().WriteStructBegin(context.Background(), "testString_args"),
+ protocol.EXPECT().WriteFieldBegin(context.Background(), "s", thrift.TType(thrift.STRING), int16(1)),
+ protocol.EXPECT().WriteString(context.Background(), "test"),
+ protocol.EXPECT().WriteFieldEnd(context.Background()),
+ protocol.EXPECT().WriteFieldStop(context.Background()),
+ protocol.EXPECT().WriteStructEnd(context.Background()),
+ protocol.EXPECT().WriteMessageEnd(context.Background()),
protocol.EXPECT().Flush(context.Background()),
- protocol.EXPECT().ReadMessageBegin().Return("testString", thrift.REPLY, int32(2), nil),
+ protocol.EXPECT().ReadMessageBegin(context.Background()).Return("testString", thrift.REPLY, int32(2), nil),
)
client := errortest.NewErrorTestClient(thrift.NewTStandardClient(protocol, protocol))
@@ -728,16 +728,16 @@
transport := thrift.NewTMemoryBuffer()
protocol := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- protocol.EXPECT().WriteMessageBegin("testString", thrift.CALL, int32(1)),
- protocol.EXPECT().WriteStructBegin("testString_args"),
- protocol.EXPECT().WriteFieldBegin("s", thrift.TType(thrift.STRING), int16(1)),
- protocol.EXPECT().WriteString("test"),
- protocol.EXPECT().WriteFieldEnd(),
- protocol.EXPECT().WriteFieldStop(),
- protocol.EXPECT().WriteStructEnd(),
- protocol.EXPECT().WriteMessageEnd(),
+ protocol.EXPECT().WriteMessageBegin(context.Background(), "testString", thrift.CALL, int32(1)),
+ protocol.EXPECT().WriteStructBegin(context.Background(), "testString_args"),
+ protocol.EXPECT().WriteFieldBegin(context.Background(), "s", thrift.TType(thrift.STRING), int16(1)),
+ protocol.EXPECT().WriteString(context.Background(), "test"),
+ protocol.EXPECT().WriteFieldEnd(context.Background()),
+ protocol.EXPECT().WriteFieldStop(context.Background()),
+ protocol.EXPECT().WriteStructEnd(context.Background()),
+ protocol.EXPECT().WriteMessageEnd(context.Background()),
protocol.EXPECT().Flush(context.Background()),
- protocol.EXPECT().ReadMessageBegin().Return("testString", thrift.REPLY, int32(2), nil),
+ protocol.EXPECT().ReadMessageBegin(context.Background()).Return("testString", thrift.REPLY, int32(2), nil),
)
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
@@ -757,16 +757,16 @@
mockCtrl := gomock.NewController(t)
protocol := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- protocol.EXPECT().WriteMessageBegin("testString", thrift.CALL, int32(1)),
- protocol.EXPECT().WriteStructBegin("testString_args"),
- protocol.EXPECT().WriteFieldBegin("s", thrift.TType(thrift.STRING), int16(1)),
- protocol.EXPECT().WriteString("test"),
- protocol.EXPECT().WriteFieldEnd(),
- protocol.EXPECT().WriteFieldStop(),
- protocol.EXPECT().WriteStructEnd(),
- protocol.EXPECT().WriteMessageEnd(),
+ protocol.EXPECT().WriteMessageBegin(context.Background(), "testString", thrift.CALL, int32(1)),
+ protocol.EXPECT().WriteStructBegin(context.Background(), "testString_args"),
+ protocol.EXPECT().WriteFieldBegin(context.Background(), "s", thrift.TType(thrift.STRING), int16(1)),
+ protocol.EXPECT().WriteString(context.Background(), "test"),
+ protocol.EXPECT().WriteFieldEnd(context.Background()),
+ protocol.EXPECT().WriteFieldStop(context.Background()),
+ protocol.EXPECT().WriteStructEnd(context.Background()),
+ protocol.EXPECT().WriteMessageEnd(context.Background()),
protocol.EXPECT().Flush(context.Background()),
- protocol.EXPECT().ReadMessageBegin().Return("unknown", thrift.REPLY, int32(1), nil),
+ protocol.EXPECT().ReadMessageBegin(context.Background()).Return("unknown", thrift.REPLY, int32(1), nil),
)
client := errortest.NewErrorTestClient(thrift.NewTStandardClient(protocol, protocol))
@@ -788,16 +788,16 @@
transport := thrift.NewTMemoryBuffer()
protocol := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- protocol.EXPECT().WriteMessageBegin("testString", thrift.CALL, int32(1)),
- protocol.EXPECT().WriteStructBegin("testString_args"),
- protocol.EXPECT().WriteFieldBegin("s", thrift.TType(thrift.STRING), int16(1)),
- protocol.EXPECT().WriteString("test"),
- protocol.EXPECT().WriteFieldEnd(),
- protocol.EXPECT().WriteFieldStop(),
- protocol.EXPECT().WriteStructEnd(),
- protocol.EXPECT().WriteMessageEnd(),
+ protocol.EXPECT().WriteMessageBegin(context.Background(), "testString", thrift.CALL, int32(1)),
+ protocol.EXPECT().WriteStructBegin(context.Background(), "testString_args"),
+ protocol.EXPECT().WriteFieldBegin(context.Background(), "s", thrift.TType(thrift.STRING), int16(1)),
+ protocol.EXPECT().WriteString(context.Background(), "test"),
+ protocol.EXPECT().WriteFieldEnd(context.Background()),
+ protocol.EXPECT().WriteFieldStop(context.Background()),
+ protocol.EXPECT().WriteStructEnd(context.Background()),
+ protocol.EXPECT().WriteMessageEnd(context.Background()),
protocol.EXPECT().Flush(context.Background()),
- protocol.EXPECT().ReadMessageBegin().Return("unknown", thrift.REPLY, int32(1), nil),
+ protocol.EXPECT().ReadMessageBegin(context.Background()).Return("unknown", thrift.REPLY, int32(1), nil),
)
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
@@ -817,16 +817,16 @@
mockCtrl := gomock.NewController(t)
protocol := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- protocol.EXPECT().WriteMessageBegin("testString", thrift.CALL, int32(1)),
- protocol.EXPECT().WriteStructBegin("testString_args"),
- protocol.EXPECT().WriteFieldBegin("s", thrift.TType(thrift.STRING), int16(1)),
- protocol.EXPECT().WriteString("test"),
- protocol.EXPECT().WriteFieldEnd(),
- protocol.EXPECT().WriteFieldStop(),
- protocol.EXPECT().WriteStructEnd(),
- protocol.EXPECT().WriteMessageEnd(),
+ protocol.EXPECT().WriteMessageBegin(context.Background(), "testString", thrift.CALL, int32(1)),
+ protocol.EXPECT().WriteStructBegin(context.Background(), "testString_args"),
+ protocol.EXPECT().WriteFieldBegin(context.Background(), "s", thrift.TType(thrift.STRING), int16(1)),
+ protocol.EXPECT().WriteString(context.Background(), "test"),
+ protocol.EXPECT().WriteFieldEnd(context.Background()),
+ protocol.EXPECT().WriteFieldStop(context.Background()),
+ protocol.EXPECT().WriteStructEnd(context.Background()),
+ protocol.EXPECT().WriteMessageEnd(context.Background()),
protocol.EXPECT().Flush(context.Background()),
- protocol.EXPECT().ReadMessageBegin().Return("testString", thrift.INVALID_TMESSAGE_TYPE, int32(1), nil),
+ protocol.EXPECT().ReadMessageBegin(context.Background()).Return("testString", thrift.INVALID_TMESSAGE_TYPE, int32(1), nil),
)
client := errortest.NewErrorTestClient(thrift.NewTStandardClient(protocol, protocol))
@@ -848,16 +848,16 @@
transport := thrift.NewTMemoryBuffer()
protocol := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- protocol.EXPECT().WriteMessageBegin("testString", thrift.CALL, int32(1)),
- protocol.EXPECT().WriteStructBegin("testString_args"),
- protocol.EXPECT().WriteFieldBegin("s", thrift.TType(thrift.STRING), int16(1)),
- protocol.EXPECT().WriteString("test"),
- protocol.EXPECT().WriteFieldEnd(),
- protocol.EXPECT().WriteFieldStop(),
- protocol.EXPECT().WriteStructEnd(),
- protocol.EXPECT().WriteMessageEnd(),
+ protocol.EXPECT().WriteMessageBegin(context.Background(), "testString", thrift.CALL, int32(1)),
+ protocol.EXPECT().WriteStructBegin(context.Background(), "testString_args"),
+ protocol.EXPECT().WriteFieldBegin(context.Background(), "s", thrift.TType(thrift.STRING), int16(1)),
+ protocol.EXPECT().WriteString(context.Background(), "test"),
+ protocol.EXPECT().WriteFieldEnd(context.Background()),
+ protocol.EXPECT().WriteFieldStop(context.Background()),
+ protocol.EXPECT().WriteStructEnd(context.Background()),
+ protocol.EXPECT().WriteMessageEnd(context.Background()),
protocol.EXPECT().Flush(context.Background()),
- protocol.EXPECT().ReadMessageBegin().Return("testString", thrift.INVALID_TMESSAGE_TYPE, int32(1), nil),
+ protocol.EXPECT().ReadMessageBegin(context.Background()).Return("testString", thrift.INVALID_TMESSAGE_TYPE, int32(1), nil),
)
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
diff --git a/lib/go/test/tests/optional_fields_test.go b/lib/go/test/tests/optional_fields_test.go
index 34ad660..7e240e6 100644
--- a/lib/go/test/tests/optional_fields_test.go
+++ b/lib/go/test/tests/optional_fields_test.go
@@ -21,6 +21,7 @@
import (
"bytes"
+ "context"
gomock "github.com/golang/mock/gomock"
"optionalfieldstest"
"testing"
@@ -185,12 +186,12 @@
defer mockCtrl.Finish()
proto := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- proto.EXPECT().WriteStructBegin("all_optional").Return(nil),
- proto.EXPECT().WriteFieldStop().Return(nil),
- proto.EXPECT().WriteStructEnd().Return(nil),
+ proto.EXPECT().WriteStructBegin(context.Background(), "all_optional").Return(nil),
+ proto.EXPECT().WriteFieldStop(context.Background()).Return(nil),
+ proto.EXPECT().WriteStructEnd(context.Background()).Return(nil),
)
ao := optionalfieldstest.NewAllOptional()
- ao.Write(proto)
+ ao.Write(context.Background(), proto)
}
func TestNoSetToDefaultFieldsOnWire(t *testing.T) {
@@ -198,13 +199,13 @@
defer mockCtrl.Finish()
proto := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- proto.EXPECT().WriteStructBegin("all_optional").Return(nil),
- proto.EXPECT().WriteFieldStop().Return(nil),
- proto.EXPECT().WriteStructEnd().Return(nil),
+ proto.EXPECT().WriteStructBegin(context.Background(), "all_optional").Return(nil),
+ proto.EXPECT().WriteFieldStop(context.Background()).Return(nil),
+ proto.EXPECT().WriteStructEnd(context.Background()).Return(nil),
)
ao := optionalfieldstest.NewAllOptional()
ao.I = 42
- ao.Write(proto)
+ ao.Write(context.Background(), proto)
}
//Make sure that only one field is being serialized when set to non-default
@@ -213,16 +214,16 @@
defer mockCtrl.Finish()
proto := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- proto.EXPECT().WriteStructBegin("all_optional").Return(nil),
- proto.EXPECT().WriteFieldBegin("i", thrift.TType(thrift.I64), int16(2)).Return(nil),
- proto.EXPECT().WriteI64(int64(123)).Return(nil),
- proto.EXPECT().WriteFieldEnd().Return(nil),
- proto.EXPECT().WriteFieldStop().Return(nil),
- proto.EXPECT().WriteStructEnd().Return(nil),
+ proto.EXPECT().WriteStructBegin(context.Background(), "all_optional").Return(nil),
+ proto.EXPECT().WriteFieldBegin(context.Background(), "i", thrift.TType(thrift.I64), int16(2)).Return(nil),
+ proto.EXPECT().WriteI64(context.Background(), int64(123)).Return(nil),
+ proto.EXPECT().WriteFieldEnd(context.Background()).Return(nil),
+ proto.EXPECT().WriteFieldStop(context.Background()).Return(nil),
+ proto.EXPECT().WriteStructEnd(context.Background()).Return(nil),
)
ao := optionalfieldstest.NewAllOptional()
ao.I = 123
- ao.Write(proto)
+ ao.Write(context.Background(), proto)
}
func TestOneLSetFieldOnWire(t *testing.T) {
@@ -230,19 +231,19 @@
defer mockCtrl.Finish()
proto := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- proto.EXPECT().WriteStructBegin("all_optional").Return(nil),
- proto.EXPECT().WriteFieldBegin("l", thrift.TType(thrift.LIST), int16(9)).Return(nil),
- proto.EXPECT().WriteListBegin(thrift.TType(thrift.I64), 2).Return(nil),
- proto.EXPECT().WriteI64(int64(1)).Return(nil),
- proto.EXPECT().WriteI64(int64(2)).Return(nil),
- proto.EXPECT().WriteListEnd().Return(nil),
- proto.EXPECT().WriteFieldEnd().Return(nil),
- proto.EXPECT().WriteFieldStop().Return(nil),
- proto.EXPECT().WriteStructEnd().Return(nil),
+ proto.EXPECT().WriteStructBegin(context.Background(), "all_optional").Return(nil),
+ proto.EXPECT().WriteFieldBegin(context.Background(), "l", thrift.TType(thrift.LIST), int16(9)).Return(nil),
+ proto.EXPECT().WriteListBegin(context.Background(), thrift.TType(thrift.I64), 2).Return(nil),
+ proto.EXPECT().WriteI64(context.Background(), int64(1)).Return(nil),
+ proto.EXPECT().WriteI64(context.Background(), int64(2)).Return(nil),
+ proto.EXPECT().WriteListEnd(context.Background()).Return(nil),
+ proto.EXPECT().WriteFieldEnd(context.Background()).Return(nil),
+ proto.EXPECT().WriteFieldStop(context.Background()).Return(nil),
+ proto.EXPECT().WriteStructEnd(context.Background()).Return(nil),
)
ao := optionalfieldstest.NewAllOptional()
ao.L = []int64{1, 2}
- ao.Write(proto)
+ ao.Write(context.Background(), proto)
}
func TestOneBinSetFieldOnWire(t *testing.T) {
@@ -250,16 +251,16 @@
defer mockCtrl.Finish()
proto := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- proto.EXPECT().WriteStructBegin("all_optional").Return(nil),
- proto.EXPECT().WriteFieldBegin("bin", thrift.TType(thrift.STRING), int16(13)).Return(nil),
- proto.EXPECT().WriteBinary([]byte("somebytestring")).Return(nil),
- proto.EXPECT().WriteFieldEnd().Return(nil),
- proto.EXPECT().WriteFieldStop().Return(nil),
- proto.EXPECT().WriteStructEnd().Return(nil),
+ proto.EXPECT().WriteStructBegin(context.Background(), "all_optional").Return(nil),
+ proto.EXPECT().WriteFieldBegin(context.Background(), "bin", thrift.TType(thrift.STRING), int16(13)).Return(nil),
+ proto.EXPECT().WriteBinary(context.Background(), []byte("somebytestring")).Return(nil),
+ proto.EXPECT().WriteFieldEnd(context.Background()).Return(nil),
+ proto.EXPECT().WriteFieldStop(context.Background()).Return(nil),
+ proto.EXPECT().WriteStructEnd(context.Background()).Return(nil),
)
ao := optionalfieldstest.NewAllOptional()
ao.Bin = []byte("somebytestring")
- ao.Write(proto)
+ ao.Write(context.Background(), proto)
}
func TestOneEmptyBinSetFieldOnWire(t *testing.T) {
@@ -267,14 +268,14 @@
defer mockCtrl.Finish()
proto := NewMockTProtocol(mockCtrl)
gomock.InOrder(
- proto.EXPECT().WriteStructBegin("all_optional").Return(nil),
- proto.EXPECT().WriteFieldBegin("bin", thrift.TType(thrift.STRING), int16(13)).Return(nil),
- proto.EXPECT().WriteBinary([]byte{}).Return(nil),
- proto.EXPECT().WriteFieldEnd().Return(nil),
- proto.EXPECT().WriteFieldStop().Return(nil),
- proto.EXPECT().WriteStructEnd().Return(nil),
+ proto.EXPECT().WriteStructBegin(context.Background(), "all_optional").Return(nil),
+ proto.EXPECT().WriteFieldBegin(context.Background(), "bin", thrift.TType(thrift.STRING), int16(13)).Return(nil),
+ proto.EXPECT().WriteBinary(context.Background(), []byte{}).Return(nil),
+ proto.EXPECT().WriteFieldEnd(context.Background()).Return(nil),
+ proto.EXPECT().WriteFieldStop(context.Background()).Return(nil),
+ proto.EXPECT().WriteStructEnd(context.Background()).Return(nil),
)
ao := optionalfieldstest.NewAllOptional()
ao.Bin = []byte{}
- ao.Write(proto)
+ ao.Write(context.Background(), proto)
}
diff --git a/lib/go/test/tests/protocol_mock.go b/lib/go/test/tests/protocol_mock.go
index 51d7a02..793e4e1 100644
--- a/lib/go/test/tests/protocol_mock.go
+++ b/lib/go/test/tests/protocol_mock.go
@@ -60,52 +60,52 @@
return _mr.mock.ctrl.RecordCall(_mr.mock, "Flush")
}
-func (_m *MockTProtocol) ReadBinary() ([]byte, error) {
- ret := _m.ctrl.Call(_m, "ReadBinary")
+func (_m *MockTProtocol) ReadBinary(ctx context.Context) ([]byte, error) {
+ ret := _m.ctrl.Call(_m, "ReadBinary", ctx)
ret0, _ := ret[0].([]byte)
ret1, _ := ret[1].(error)
return ret0, ret1
}
-func (_mr *_MockTProtocolRecorder) ReadBinary() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadBinary")
+func (_mr *_MockTProtocolRecorder) ReadBinary(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadBinary", ctx)
}
-func (_m *MockTProtocol) ReadBool() (bool, error) {
- ret := _m.ctrl.Call(_m, "ReadBool")
+func (_m *MockTProtocol) ReadBool(ctx context.Context) (bool, error) {
+ ret := _m.ctrl.Call(_m, "ReadBool", ctx)
ret0, _ := ret[0].(bool)
ret1, _ := ret[1].(error)
return ret0, ret1
}
-func (_mr *_MockTProtocolRecorder) ReadBool() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadBool")
+func (_mr *_MockTProtocolRecorder) ReadBool(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadBool", ctx)
}
-func (_m *MockTProtocol) ReadByte() (int8, error) {
- ret := _m.ctrl.Call(_m, "ReadByte")
+func (_m *MockTProtocol) ReadByte(ctx context.Context) (int8, error) {
+ ret := _m.ctrl.Call(_m, "ReadByte", ctx)
ret0, _ := ret[0].(int8)
ret1, _ := ret[1].(error)
return ret0, ret1
}
-func (_mr *_MockTProtocolRecorder) ReadByte() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadByte")
+func (_mr *_MockTProtocolRecorder) ReadByte(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadByte", ctx)
}
-func (_m *MockTProtocol) ReadDouble() (float64, error) {
- ret := _m.ctrl.Call(_m, "ReadDouble")
+func (_m *MockTProtocol) ReadDouble(ctx context.Context) (float64, error) {
+ ret := _m.ctrl.Call(_m, "ReadDouble", ctx)
ret0, _ := ret[0].(float64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
-func (_mr *_MockTProtocolRecorder) ReadDouble() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadDouble")
+func (_mr *_MockTProtocolRecorder) ReadDouble(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadDouble", ctx)
}
-func (_m *MockTProtocol) ReadFieldBegin() (string, thrift.TType, int16, error) {
- ret := _m.ctrl.Call(_m, "ReadFieldBegin")
+func (_m *MockTProtocol) ReadFieldBegin(ctx context.Context) (string, thrift.TType, int16, error) {
+ ret := _m.ctrl.Call(_m, "ReadFieldBegin", ctx)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(thrift.TType)
ret2, _ := ret[2].(int16)
@@ -113,77 +113,77 @@
return ret0, ret1, ret2, ret3
}
-func (_mr *_MockTProtocolRecorder) ReadFieldBegin() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadFieldBegin")
+func (_mr *_MockTProtocolRecorder) ReadFieldBegin(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadFieldBegin", ctx)
}
-func (_m *MockTProtocol) ReadFieldEnd() error {
- ret := _m.ctrl.Call(_m, "ReadFieldEnd")
+func (_m *MockTProtocol) ReadFieldEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "ReadFieldEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) ReadFieldEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadFieldEnd")
+func (_mr *_MockTProtocolRecorder) ReadFieldEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadFieldEnd", ctx)
}
-func (_m *MockTProtocol) ReadI16() (int16, error) {
- ret := _m.ctrl.Call(_m, "ReadI16")
+func (_m *MockTProtocol) ReadI16(ctx context.Context) (int16, error) {
+ ret := _m.ctrl.Call(_m, "ReadI16", ctx)
ret0, _ := ret[0].(int16)
ret1, _ := ret[1].(error)
return ret0, ret1
}
-func (_mr *_MockTProtocolRecorder) ReadI16() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadI16")
+func (_mr *_MockTProtocolRecorder) ReadI16(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadI16", ctx)
}
-func (_m *MockTProtocol) ReadI32() (int32, error) {
- ret := _m.ctrl.Call(_m, "ReadI32")
+func (_m *MockTProtocol) ReadI32(ctx context.Context) (int32, error) {
+ ret := _m.ctrl.Call(_m, "ReadI32", ctx)
ret0, _ := ret[0].(int32)
ret1, _ := ret[1].(error)
return ret0, ret1
}
-func (_mr *_MockTProtocolRecorder) ReadI32() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadI32")
+func (_mr *_MockTProtocolRecorder) ReadI32(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadI32", ctx)
}
-func (_m *MockTProtocol) ReadI64() (int64, error) {
- ret := _m.ctrl.Call(_m, "ReadI64")
+func (_m *MockTProtocol) ReadI64(ctx context.Context) (int64, error) {
+ ret := _m.ctrl.Call(_m, "ReadI64", ctx)
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
-func (_mr *_MockTProtocolRecorder) ReadI64() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadI64")
+func (_mr *_MockTProtocolRecorder) ReadI64(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadI64", ctx)
}
-func (_m *MockTProtocol) ReadListBegin() (thrift.TType, int, error) {
- ret := _m.ctrl.Call(_m, "ReadListBegin")
+func (_m *MockTProtocol) ReadListBegin(ctx context.Context) (thrift.TType, int, error) {
+ ret := _m.ctrl.Call(_m, "ReadListBegin", ctx)
ret0, _ := ret[0].(thrift.TType)
ret1, _ := ret[1].(int)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
}
-func (_mr *_MockTProtocolRecorder) ReadListBegin() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadListBegin")
+func (_mr *_MockTProtocolRecorder) ReadListBegin(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadListBegin", ctx)
}
-func (_m *MockTProtocol) ReadListEnd() error {
- ret := _m.ctrl.Call(_m, "ReadListEnd")
+func (_m *MockTProtocol) ReadListEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "ReadListEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) ReadListEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadListEnd")
+func (_mr *_MockTProtocolRecorder) ReadListEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadListEnd", ctx)
}
-func (_m *MockTProtocol) ReadMapBegin() (thrift.TType, thrift.TType, int, error) {
- ret := _m.ctrl.Call(_m, "ReadMapBegin")
+func (_m *MockTProtocol) ReadMapBegin(ctx context.Context) (thrift.TType, thrift.TType, int, error) {
+ ret := _m.ctrl.Call(_m, "ReadMapBegin", ctx)
ret0, _ := ret[0].(thrift.TType)
ret1, _ := ret[1].(thrift.TType)
ret2, _ := ret[2].(int)
@@ -191,22 +191,22 @@
return ret0, ret1, ret2, ret3
}
-func (_mr *_MockTProtocolRecorder) ReadMapBegin() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMapBegin")
+func (_mr *_MockTProtocolRecorder) ReadMapBegin(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMapBegin", ctx)
}
-func (_m *MockTProtocol) ReadMapEnd() error {
- ret := _m.ctrl.Call(_m, "ReadMapEnd")
+func (_m *MockTProtocol) ReadMapEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "ReadMapEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) ReadMapEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMapEnd")
+func (_mr *_MockTProtocolRecorder) ReadMapEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMapEnd", ctx)
}
-func (_m *MockTProtocol) ReadMessageBegin() (string, thrift.TMessageType, int32, error) {
- ret := _m.ctrl.Call(_m, "ReadMessageBegin")
+func (_m *MockTProtocol) ReadMessageBegin(ctx context.Context) (string, thrift.TMessageType, int32, error) {
+ ret := _m.ctrl.Call(_m, "ReadMessageBegin", ctx)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(thrift.TMessageType)
ret2, _ := ret[2].(int32)
@@ -214,82 +214,82 @@
return ret0, ret1, ret2, ret3
}
-func (_mr *_MockTProtocolRecorder) ReadMessageBegin() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMessageBegin")
+func (_mr *_MockTProtocolRecorder) ReadMessageBegin(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMessageBegin", ctx)
}
-func (_m *MockTProtocol) ReadMessageEnd() error {
- ret := _m.ctrl.Call(_m, "ReadMessageEnd")
+func (_m *MockTProtocol) ReadMessageEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "ReadMessageEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) ReadMessageEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMessageEnd")
+func (_mr *_MockTProtocolRecorder) ReadMessageEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMessageEnd", ctx)
}
-func (_m *MockTProtocol) ReadSetBegin() (thrift.TType, int, error) {
- ret := _m.ctrl.Call(_m, "ReadSetBegin")
+func (_m *MockTProtocol) ReadSetBegin(ctx context.Context) (thrift.TType, int, error) {
+ ret := _m.ctrl.Call(_m, "ReadSetBegin", ctx)
ret0, _ := ret[0].(thrift.TType)
ret1, _ := ret[1].(int)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
}
-func (_mr *_MockTProtocolRecorder) ReadSetBegin() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadSetBegin")
+func (_mr *_MockTProtocolRecorder) ReadSetBegin(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadSetBegin", ctx)
}
-func (_m *MockTProtocol) ReadSetEnd() error {
- ret := _m.ctrl.Call(_m, "ReadSetEnd")
+func (_m *MockTProtocol) ReadSetEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "ReadSetEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) ReadSetEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadSetEnd")
+func (_mr *_MockTProtocolRecorder) ReadSetEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadSetEnd", ctx)
}
-func (_m *MockTProtocol) ReadString() (string, error) {
- ret := _m.ctrl.Call(_m, "ReadString")
+func (_m *MockTProtocol) ReadString(ctx context.Context) (string, error) {
+ ret := _m.ctrl.Call(_m, "ReadString", ctx)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
}
-func (_mr *_MockTProtocolRecorder) ReadString() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadString")
+func (_mr *_MockTProtocolRecorder) ReadString(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadString", ctx)
}
-func (_m *MockTProtocol) ReadStructBegin() (string, error) {
- ret := _m.ctrl.Call(_m, "ReadStructBegin")
+func (_m *MockTProtocol) ReadStructBegin(ctx context.Context) (string, error) {
+ ret := _m.ctrl.Call(_m, "ReadStructBegin", ctx)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
}
-func (_mr *_MockTProtocolRecorder) ReadStructBegin() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadStructBegin")
+func (_mr *_MockTProtocolRecorder) ReadStructBegin(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadStructBegin", ctx)
}
-func (_m *MockTProtocol) ReadStructEnd() error {
- ret := _m.ctrl.Call(_m, "ReadStructEnd")
+func (_m *MockTProtocol) ReadStructEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "ReadStructEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) ReadStructEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadStructEnd")
+func (_mr *_MockTProtocolRecorder) ReadStructEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadStructEnd", ctx)
}
-func (_m *MockTProtocol) Skip(_param0 thrift.TType) error {
- ret := _m.ctrl.Call(_m, "Skip", _param0)
+func (_m *MockTProtocol) Skip(ctx context.Context, _param0 thrift.TType) error {
+ ret := _m.ctrl.Call(_m, "Skip", ctx, _param0)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) Skip(arg0 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "Skip", arg0)
+func (_mr *_MockTProtocolRecorder) Skip(ctx context.Context, arg0 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "Skip", ctx, arg0)
}
func (_m *MockTProtocol) Transport() thrift.TTransport {
@@ -302,212 +302,212 @@
return _mr.mock.ctrl.RecordCall(_mr.mock, "Transport")
}
-func (_m *MockTProtocol) WriteBinary(_param0 []byte) error {
- ret := _m.ctrl.Call(_m, "WriteBinary", _param0)
+func (_m *MockTProtocol) WriteBinary(ctx context.Context, _param0 []byte) error {
+ ret := _m.ctrl.Call(_m, "WriteBinary", ctx, _param0)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteBinary(arg0 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteBinary", arg0)
+func (_mr *_MockTProtocolRecorder) WriteBinary(ctx context.Context, arg0 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteBinary", ctx, arg0)
}
-func (_m *MockTProtocol) WriteBool(_param0 bool) error {
- ret := _m.ctrl.Call(_m, "WriteBool", _param0)
+func (_m *MockTProtocol) WriteBool(ctx context.Context, _param0 bool) error {
+ ret := _m.ctrl.Call(_m, "WriteBool", ctx, _param0)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteBool(arg0 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteBool", arg0)
+func (_mr *_MockTProtocolRecorder) WriteBool(ctx context.Context, arg0 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteBool", ctx, arg0)
}
-func (_m *MockTProtocol) WriteByte(_param0 int8) error {
- ret := _m.ctrl.Call(_m, "WriteByte", _param0)
+func (_m *MockTProtocol) WriteByte(ctx context.Context, _param0 int8) error {
+ ret := _m.ctrl.Call(_m, "WriteByte", ctx, _param0)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteByte(arg0 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteByte", arg0)
+func (_mr *_MockTProtocolRecorder) WriteByte(ctx context.Context, arg0 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteByte", ctx, arg0)
}
-func (_m *MockTProtocol) WriteDouble(_param0 float64) error {
- ret := _m.ctrl.Call(_m, "WriteDouble", _param0)
+func (_m *MockTProtocol) WriteDouble(ctx context.Context, _param0 float64) error {
+ ret := _m.ctrl.Call(_m, "WriteDouble", ctx, _param0)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteDouble(arg0 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteDouble", arg0)
+func (_mr *_MockTProtocolRecorder) WriteDouble(ctx context.Context, arg0 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteDouble", ctx, arg0)
}
-func (_m *MockTProtocol) WriteFieldBegin(_param0 string, _param1 thrift.TType, _param2 int16) error {
- ret := _m.ctrl.Call(_m, "WriteFieldBegin", _param0, _param1, _param2)
+func (_m *MockTProtocol) WriteFieldBegin(ctx context.Context, _param0 string, _param1 thrift.TType, _param2 int16) error {
+ ret := _m.ctrl.Call(_m, "WriteFieldBegin", ctx, _param0, _param1, _param2)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteFieldBegin(arg0, arg1, arg2 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteFieldBegin", arg0, arg1, arg2)
+func (_mr *_MockTProtocolRecorder) WriteFieldBegin(ctx context.Context, arg0, arg1, arg2 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteFieldBegin", ctx, arg0, arg1, arg2)
}
-func (_m *MockTProtocol) WriteFieldEnd() error {
- ret := _m.ctrl.Call(_m, "WriteFieldEnd")
+func (_m *MockTProtocol) WriteFieldEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "WriteFieldEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteFieldEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteFieldEnd")
+func (_mr *_MockTProtocolRecorder) WriteFieldEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteFieldEnd", ctx)
}
-func (_m *MockTProtocol) WriteFieldStop() error {
- ret := _m.ctrl.Call(_m, "WriteFieldStop")
+func (_m *MockTProtocol) WriteFieldStop(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "WriteFieldStop", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteFieldStop() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteFieldStop")
+func (_mr *_MockTProtocolRecorder) WriteFieldStop(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteFieldStop", ctx)
}
-func (_m *MockTProtocol) WriteI16(_param0 int16) error {
- ret := _m.ctrl.Call(_m, "WriteI16", _param0)
+func (_m *MockTProtocol) WriteI16(ctx context.Context, _param0 int16) error {
+ ret := _m.ctrl.Call(_m, "WriteI16", ctx, _param0)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteI16(arg0 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteI16", arg0)
+func (_mr *_MockTProtocolRecorder) WriteI16(ctx context.Context, arg0 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteI16", ctx, arg0)
}
-func (_m *MockTProtocol) WriteI32(_param0 int32) error {
- ret := _m.ctrl.Call(_m, "WriteI32", _param0)
+func (_m *MockTProtocol) WriteI32(ctx context.Context, _param0 int32) error {
+ ret := _m.ctrl.Call(_m, "WriteI32", ctx, _param0)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteI32(arg0 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteI32", arg0)
+func (_mr *_MockTProtocolRecorder) WriteI32(ctx context.Context, arg0 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteI32", ctx, arg0)
}
-func (_m *MockTProtocol) WriteI64(_param0 int64) error {
- ret := _m.ctrl.Call(_m, "WriteI64", _param0)
+func (_m *MockTProtocol) WriteI64(ctx context.Context, _param0 int64) error {
+ ret := _m.ctrl.Call(_m, "WriteI64", ctx, _param0)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteI64(arg0 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteI64", arg0)
+func (_mr *_MockTProtocolRecorder) WriteI64(ctx context.Context, arg0 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteI64", ctx, arg0)
}
-func (_m *MockTProtocol) WriteListBegin(_param0 thrift.TType, _param1 int) error {
- ret := _m.ctrl.Call(_m, "WriteListBegin", _param0, _param1)
+func (_m *MockTProtocol) WriteListBegin(ctx context.Context, _param0 thrift.TType, _param1 int) error {
+ ret := _m.ctrl.Call(_m, "WriteListBegin", ctx, _param0, _param1)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteListBegin(arg0, arg1 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteListBegin", arg0, arg1)
+func (_mr *_MockTProtocolRecorder) WriteListBegin(ctx context.Context, arg0, arg1 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteListBegin", ctx, arg0, arg1)
}
-func (_m *MockTProtocol) WriteListEnd() error {
- ret := _m.ctrl.Call(_m, "WriteListEnd")
+func (_m *MockTProtocol) WriteListEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "WriteListEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteListEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteListEnd")
+func (_mr *_MockTProtocolRecorder) WriteListEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteListEnd", ctx)
}
-func (_m *MockTProtocol) WriteMapBegin(_param0 thrift.TType, _param1 thrift.TType, _param2 int) error {
- ret := _m.ctrl.Call(_m, "WriteMapBegin", _param0, _param1, _param2)
+func (_m *MockTProtocol) WriteMapBegin(ctx context.Context, _param0 thrift.TType, _param1 thrift.TType, _param2 int) error {
+ ret := _m.ctrl.Call(_m, "WriteMapBegin", ctx, _param0, _param1, _param2)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteMapBegin(arg0, arg1, arg2 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMapBegin", arg0, arg1, arg2)
+func (_mr *_MockTProtocolRecorder) WriteMapBegin(ctx context.Context, arg0, arg1, arg2 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMapBegin", ctx, arg0, arg1, arg2)
}
-func (_m *MockTProtocol) WriteMapEnd() error {
- ret := _m.ctrl.Call(_m, "WriteMapEnd")
+func (_m *MockTProtocol) WriteMapEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "WriteMapEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteMapEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMapEnd")
+func (_mr *_MockTProtocolRecorder) WriteMapEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMapEnd", ctx)
}
-func (_m *MockTProtocol) WriteMessageBegin(_param0 string, _param1 thrift.TMessageType, _param2 int32) error {
- ret := _m.ctrl.Call(_m, "WriteMessageBegin", _param0, _param1, _param2)
+func (_m *MockTProtocol) WriteMessageBegin(ctx context.Context, _param0 string, _param1 thrift.TMessageType, _param2 int32) error {
+ ret := _m.ctrl.Call(_m, "WriteMessageBegin", ctx, _param0, _param1, _param2)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteMessageBegin(arg0, arg1, arg2 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMessageBegin", arg0, arg1, arg2)
+func (_mr *_MockTProtocolRecorder) WriteMessageBegin(ctx context.Context, arg0, arg1, arg2 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMessageBegin", ctx, arg0, arg1, arg2)
}
-func (_m *MockTProtocol) WriteMessageEnd() error {
- ret := _m.ctrl.Call(_m, "WriteMessageEnd")
+func (_m *MockTProtocol) WriteMessageEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "WriteMessageEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteMessageEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMessageEnd")
+func (_mr *_MockTProtocolRecorder) WriteMessageEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMessageEnd", ctx)
}
-func (_m *MockTProtocol) WriteSetBegin(_param0 thrift.TType, _param1 int) error {
- ret := _m.ctrl.Call(_m, "WriteSetBegin", _param0, _param1)
+func (_m *MockTProtocol) WriteSetBegin(ctx context.Context, _param0 thrift.TType, _param1 int) error {
+ ret := _m.ctrl.Call(_m, "WriteSetBegin", ctx, _param0, _param1)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteSetBegin(arg0, arg1 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteSetBegin", arg0, arg1)
+func (_mr *_MockTProtocolRecorder) WriteSetBegin(ctx context.Context, arg0, arg1 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteSetBegin", ctx, arg0, arg1)
}
-func (_m *MockTProtocol) WriteSetEnd() error {
- ret := _m.ctrl.Call(_m, "WriteSetEnd")
+func (_m *MockTProtocol) WriteSetEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "WriteSetEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteSetEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteSetEnd")
+func (_mr *_MockTProtocolRecorder) WriteSetEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteSetEnd", ctx)
}
-func (_m *MockTProtocol) WriteString(_param0 string) error {
- ret := _m.ctrl.Call(_m, "WriteString", _param0)
+func (_m *MockTProtocol) WriteString(ctx context.Context, _param0 string) error {
+ ret := _m.ctrl.Call(_m, "WriteString", ctx, _param0)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteString(arg0 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteString", arg0)
+func (_mr *_MockTProtocolRecorder) WriteString(ctx context.Context, arg0 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteString", ctx, arg0)
}
-func (_m *MockTProtocol) WriteStructBegin(_param0 string) error {
- ret := _m.ctrl.Call(_m, "WriteStructBegin", _param0)
+func (_m *MockTProtocol) WriteStructBegin(ctx context.Context, _param0 string) error {
+ ret := _m.ctrl.Call(_m, "WriteStructBegin", ctx, _param0)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteStructBegin(arg0 interface{}) *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteStructBegin", arg0)
+func (_mr *_MockTProtocolRecorder) WriteStructBegin(ctx context.Context, arg0 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteStructBegin", ctx, arg0)
}
-func (_m *MockTProtocol) WriteStructEnd() error {
- ret := _m.ctrl.Call(_m, "WriteStructEnd")
+func (_m *MockTProtocol) WriteStructEnd(ctx context.Context) error {
+ ret := _m.ctrl.Call(_m, "WriteStructEnd", ctx)
ret0, _ := ret[0].(error)
return ret0
}
-func (_mr *_MockTProtocolRecorder) WriteStructEnd() *gomock.Call {
- return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteStructEnd")
+func (_mr *_MockTProtocolRecorder) WriteStructEnd(ctx context.Context) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteStructEnd", ctx)
}
diff --git a/lib/go/test/tests/required_fields_test.go b/lib/go/test/tests/required_fields_test.go
index 3fa414a..06e8560 100644
--- a/lib/go/test/tests/required_fields_test.go
+++ b/lib/go/test/tests/required_fields_test.go
@@ -37,7 +37,7 @@
}
d := thrift.NewTDeserializer()
- err = d.Read(&requiredfieldtest.RequiredField{}, sourceData)
+ err = d.Read(context.Background(), &requiredfieldtest.RequiredField{}, sourceData)
if err != nil {
t.Fatalf("Did not expect an error when trying to deserialize the requiredfieldtest.RequiredField: %v", err)
}
@@ -53,7 +53,7 @@
// attempt to deserialize into a different type (which should fail)
d := thrift.NewTDeserializer()
- err = d.Read(&requiredfieldtest.RequiredField{}, sourceData)
+ err = d.Read(context.Background(), &requiredfieldtest.RequiredField{}, sourceData)
if err == nil {
t.Fatal("Expected an error when trying to deserialize an object which is missing a required field")
}
@@ -66,12 +66,12 @@
// None of required fields are set
gomock.InOrder(
- protocol.EXPECT().ReadStructBegin().Return("StructC", nil),
- protocol.EXPECT().ReadFieldBegin().Return("_", thrift.TType(thrift.STOP), int16(1), nil),
- protocol.EXPECT().ReadStructEnd().Return(nil),
+ protocol.EXPECT().ReadStructBegin(context.Background()).Return("StructC", nil),
+ protocol.EXPECT().ReadFieldBegin(context.Background()).Return("_", thrift.TType(thrift.STOP), int16(1), nil),
+ protocol.EXPECT().ReadStructEnd(context.Background()).Return(nil),
)
- err := testStruct.Read(protocol)
+ err := testStruct.Read(context.Background(), protocol)
mockCtrl.Finish()
mockCtrl = gomock.NewController(t)
if err == nil {
@@ -87,15 +87,15 @@
// One of the required fields is set
gomock.InOrder(
- protocol.EXPECT().ReadStructBegin().Return("StructC", nil),
- protocol.EXPECT().ReadFieldBegin().Return("I", thrift.TType(thrift.I32), int16(2), nil),
- protocol.EXPECT().ReadI32().Return(int32(1), nil),
- protocol.EXPECT().ReadFieldEnd().Return(nil),
- protocol.EXPECT().ReadFieldBegin().Return("_", thrift.TType(thrift.STOP), int16(1), nil),
- protocol.EXPECT().ReadStructEnd().Return(nil),
+ protocol.EXPECT().ReadStructBegin(context.Background()).Return("StructC", nil),
+ protocol.EXPECT().ReadFieldBegin(context.Background()).Return("I", thrift.TType(thrift.I32), int16(2), nil),
+ protocol.EXPECT().ReadI32(context.Background()).Return(int32(1), nil),
+ protocol.EXPECT().ReadFieldEnd(context.Background()).Return(nil),
+ protocol.EXPECT().ReadFieldBegin(context.Background()).Return("_", thrift.TType(thrift.STOP), int16(1), nil),
+ protocol.EXPECT().ReadStructEnd(context.Background()).Return(nil),
)
- err = testStruct.Read(protocol)
+ err = testStruct.Read(context.Background(), protocol)
mockCtrl.Finish()
mockCtrl = gomock.NewController(t)
if err == nil {
@@ -111,18 +111,18 @@
// Both of the required fields are set
gomock.InOrder(
- protocol.EXPECT().ReadStructBegin().Return("StructC", nil),
- protocol.EXPECT().ReadFieldBegin().Return("i", thrift.TType(thrift.I32), int16(2), nil),
- protocol.EXPECT().ReadI32().Return(int32(1), nil),
- protocol.EXPECT().ReadFieldEnd().Return(nil),
- protocol.EXPECT().ReadFieldBegin().Return("s2", thrift.TType(thrift.STRING), int16(4), nil),
- protocol.EXPECT().ReadString().Return("test", nil),
- protocol.EXPECT().ReadFieldEnd().Return(nil),
- protocol.EXPECT().ReadFieldBegin().Return("_", thrift.TType(thrift.STOP), int16(1), nil),
- protocol.EXPECT().ReadStructEnd().Return(nil),
+ protocol.EXPECT().ReadStructBegin(context.Background()).Return("StructC", nil),
+ protocol.EXPECT().ReadFieldBegin(context.Background()).Return("i", thrift.TType(thrift.I32), int16(2), nil),
+ protocol.EXPECT().ReadI32(context.Background()).Return(int32(1), nil),
+ protocol.EXPECT().ReadFieldEnd(context.Background()).Return(nil),
+ protocol.EXPECT().ReadFieldBegin(context.Background()).Return("s2", thrift.TType(thrift.STRING), int16(4), nil),
+ protocol.EXPECT().ReadString(context.Background()).Return("test", nil),
+ protocol.EXPECT().ReadFieldEnd(context.Background()).Return(nil),
+ protocol.EXPECT().ReadFieldBegin(context.Background()).Return("_", thrift.TType(thrift.STOP), int16(1), nil),
+ protocol.EXPECT().ReadStructEnd(context.Background()).Return(nil),
)
- err = testStruct.Read(protocol)
+ err = testStruct.Read(context.Background(), protocol)
mockCtrl.Finish()
if err != nil {
t.Fatal("Expected read to succeed")