diff --git a/client/compression/Compression.go b/client/compression/Compression.go index 499ed88..2ad6b6d 100644 --- a/client/compression/Compression.go +++ b/client/compression/Compression.go @@ -16,6 +16,8 @@ import ( "github.com/XiaoMi/talos-sdk-golang/thrift/message" "github.com/XiaoMi/talos-sdk-golang/utils" + "github.com/DataDog/zstd" + "github.com/bkaradzic/go-lz4" xSnappy "github.com/eapache/go-xerial-snappy" ) @@ -62,6 +64,19 @@ func DoCompress(messageList []*message.Message, writer.Write(messageSerializedBuffer.Bytes()) writer.Close() messageBlockData = append(messageBlockData, gzipBuf.Bytes()...) + case message.MessageCompressionType_ZSTD: + result, err := zstd.Compress(nil, messageSerializedBuffer.Bytes()) + if err != nil { + return nil, err + } + messageBlockData = append(messageBlockData, result...) + case message.MessageCompressionType_LZ4: + compressed := make([]byte, 0) + compressed, err := lz4.Encode(nil, messageSerializedBuffer.Bytes()) + if err != nil { + return nil, err + } + messageBlockData = append(messageBlockData, compressed...) default: err := fmt.Errorf("unsupport compression type") return nil, err @@ -120,6 +135,19 @@ func DoDecompress(messageBlock *message.MessageBlock, return nil, err } messageBlockData = bytes.NewBuffer(messageByteSlice) + case message.MessageCompressionType_ZSTD: + result, err := zstd.Decompress(nil, messageBlock.GetMessageBlock()) + if err != nil { + return nil, err + } + messageBlockData = bytes.NewBuffer(result) + case message.MessageCompressionType_LZ4: + decompressed := make([]byte, 0) + decompressed, err := lz4.Decode(nil, messageBlock.GetMessageBlock()) + if err != nil { + return nil, err + } + messageBlockData = bytes.NewBuffer(decompressed) } for i := int32(0); i < messageNumber; i++ { diff --git a/consumer/TalosTopicsConsumer.go b/consumer/TalosTopicsConsumer.go index 20b581d..c458edf 100644 --- a/consumer/TalosTopicsConsumer.go +++ b/consumer/TalosTopicsConsumer.go @@ -255,7 +255,7 @@ func NewDefaultTalosMultiTopicsConsumer(consumerGroupName string, consumerConfig } func (c *TalosTopicsConsumer) getTopicAndScheduleInfo() error { - response, err := c.talosAdmin.LookupTopics(&message.LookupTopicsRequest{TopicPattern: c.topicPattern}) + response, err := c.talosAdmin.LookupTopics(&message.LookupTopicsRequest{TopicGroup: c.topicGroup}) if err != nil { return err } @@ -733,7 +733,7 @@ func (c *TalosTopicsConsumer) CheckTopicPatternTask() { } } response, err := c.scheduleInfoCache.GetOrCreateMessageClient(topicAndPartition).LookupTopics( - &message.LookupTopicsRequest{TopicPattern: c.topicPattern}) + &message.LookupTopicsRequest{TopicGroup: c.topicGroup}) if err != nil { c.log.Errorf("Exception in CheckTopicsTask: %s", err.Error()) return diff --git a/go.mod b/go.mod index 68057ff..0d91b50 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,10 @@ module github.com/XiaoMi/talos-sdk-golang -go 1.12 +go 1.14 require ( + github.com/DataDog/zstd v1.5.5 + github.com/bkaradzic/go-lz4 v1.0.0 github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 github.com/gofrs/uuid v3.2.0+incompatible github.com/golang/mock v1.3.1 diff --git a/go.sum b/go.sum index 5f7f99a..540e3f5 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,7 @@ +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/bkaradzic/go-lz4 v1.0.0 h1:RXc4wYsyz985CkXXeX04y4VnZFGG8Rd43pRaHsOXAKk= +github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/producer/TalosProducerConfig.go b/producer/TalosProducerConfig.go index a649b4f..75f14a2 100644 --- a/producer/TalosProducerConfig.go +++ b/producer/TalosProducerConfig.go @@ -101,7 +101,7 @@ func initProducerConfig(props *utils.Properties) (*TalosProducerConfig, error) { compressionType := props.GetProperty( GALAXY_TALOS_PRODUCER_COMPRESSION_TYPE, GALAXY_TALOS_PRODUCER_COMPRESSION_TYPE_DEFAULT) - if compressionType != "NONE" && compressionType != "SNAPPY" && + if compressionType != "NONE" && compressionType != "SNAPPY" && compressionType != "ZSTD" && compressionType != "LZ4" && compressionType != "GZIP" { return nil, fmt.Errorf("Unsupported Compression Type: %v ", compressionType) } @@ -201,12 +201,16 @@ func (p *TalosProducerConfig) GetCompressionType() message.MessageCompressionTyp return message.MessageCompressionType_NONE } else if p.compressionType == "SNAPPY" { return message.MessageCompressionType_SNAPPY + } else if p.compressionType == "GZIP" { + return message.MessageCompressionType_GZIP + } else if p.compressionType == "ZSTD" { + return message.MessageCompressionType_ZSTD } else { - err := utils.CheckArgument(p.compressionType == "GZIP") + err := utils.CheckArgument(p.compressionType == "LZ4") if err != nil { return message.MessageCompressionType(0) } - return message.MessageCompressionType_GZIP + return message.MessageCompressionType_LZ4 } } diff --git a/producer/TalosProducerConfigKey.go b/producer/TalosProducerConfigKey.go index b1acaf9..cf7cc6b 100644 --- a/producer/TalosProducerConfigKey.go +++ b/producer/TalosProducerConfigKey.go @@ -82,7 +82,7 @@ const ( GALAXY_TALOS_PRODUCER_WAIT_PARTITION_WORKING_TIME_DEFAULT = 200 /** - * The producer compression type, right now suport "NONE", "SNAPPY" and "GZIP"; + * The producer compression type, right now suport "NONE", "SNAPPY", "GZIP", "ZSTD" and "LZ4"; * default is "SNAPPY"; */ GALAXY_TALOS_PRODUCER_COMPRESSION_TYPE = "galaxy.talos.producer.compression.type" diff --git a/test/client/compression_test.go b/test/client/compression_test.go index 105d9ae..9120618 100644 --- a/test/client/compression_test.go +++ b/test/client/compression_test.go @@ -163,3 +163,49 @@ func TestGzip(t *testing.T) { } } + +func TestCompression(t *testing.T) { + messageList := setUp() + compressionTypeList := []message.MessageCompressionType{ + message.MessageCompressionType_NONE, + message.MessageCompressionType_SNAPPY, + message.MessageCompressionType_GZIP, + message.MessageCompressionType_ZSTD, + message.MessageCompressionType_LZ4, + } + for _, compressionType := range compressionTypeList { + messageBlock, err := compression.Compress(messageList, compressionType) + if err != nil { + t.Errorf("compression type error") + } + if int32(len(messageList)) != messageBlock.GetMessageNumber() { + t.Errorf("message number error") + } + + startOffset := int64(1234) + appendTimestamp := int64(1110000) + unHandledMessageNumber := int64(117) + + messageBlock.StartMessageOffset = startOffset + messageBlock.AppendTimestamp = &appendTimestamp + t.Logf("CompressionType: %s, message BlockSize: %v", messageBlock.CompressionType.String(), len(messageBlock.GetMessageBlock())) + + verifyMessageList, err := compression.DoDecompress(messageBlock, unHandledMessageNumber) + if len(verifyMessageList) != len(messageList) || err != nil { + t.Errorf("decompress error: wrong size or unKnow") + } + for i := 0; i < len(messageList); i++ { + msg := messageList[i] + verifyMsg := verifyMessageList[i].GetMessage() + if msg.GetPartitionKey() != verifyMsg.GetPartitionKey() || + msg.GetCreateTimestamp() != verifyMsg.GetCreateTimestamp() || + appendTimestamp != verifyMsg.GetAppendTimestamp() || + msg.GetSequenceNumber() != verifyMsg.GetSequenceNumber() || + !reflect.DeepEqual(msg.GetMessage(), verifyMsg.GetMessage()) || + (startOffset+int64(i)) != verifyMessageList[i].GetMessageOffset() || + verifyMessageList[i].GetUnHandledMessageNumber() != (unHandledMessageNumber+int64(len(messageList))-1-int64(i)) { + t.Errorf("decompress message not equal to source message") + } + } + } +} diff --git a/test/client/scheduleinfocache_test.go b/test/client/scheduleinfocache_test.go index 2b14110..5e63e97 100644 --- a/test/client/scheduleinfocache_test.go +++ b/test/client/scheduleinfocache_test.go @@ -9,14 +9,14 @@ package client import ( "testing" - "talos-sdk-golang/thrift/message" - "talos-sdk-golang/thrift/topic" + "github.com/XiaoMi/talos-sdk-golang/thrift/message" + "github.com/XiaoMi/talos-sdk-golang/thrift/topic" - "talos-sdk-golang/utils" + "github.com/XiaoMi/talos-sdk-golang/utils" - "talos-sdk-golang/client" - "talos-sdk-golang/testos-sdk-golang/test/mock_client" - "talos-sdk-golang/testos-sdk-golang/test/mock_message" + "github.com/XiaoMi/talos-sdk-golang/client" + "github.com/XiaoMi/talos-sdk-golang/test/mock_client" + "github.com/XiaoMi/talos-sdk-golang/test/mock_message" "github.com/golang/mock/gomock" log4go "github.com/sirupsen/logrus" @@ -35,7 +35,8 @@ const ( ) func TestNewAndGetScheduleInfoCache(t *testing.T) { - log4go.Close() + //log4go.Close() + var logger log4go.Logger properties := utils.NewProperties() properties.SetProperty("galaxy.talos.service.endpoint", "https://talos.api.xiaomi.com") clientConfig := client.NewTalosClientConfigByProperties(properties) @@ -54,17 +55,17 @@ func TestNewAndGetScheduleInfoCache(t *testing.T) { defer ctrl.Finish() mockMessageClient := mock_message.NewMockMessageService(ctrl) mockMessageClient.EXPECT().GetScheduleInfo(gomock.Any()).Return(getScheduleInfoResponse, nil).Times(1) - mockClientFactory := mock_client.NewMockTalosClient(ctrl) + mockClientFactory := mock_client.NewMockTalosClientFactoryInterface(ctrl) //test new scheduleinfocache - scheduleInfoCache0 := client.NewScheduleInfoCache(topicTalosResourceName0, - clientConfig, mockMessageClient, mockClientFactory) + scheduleInfoCache0 := client.NewAutoLocationScheduleInfoCache(topicTalosResourceName0, + clientConfig, mockMessageClient, mockClientFactory, &logger) - scheduleInfoCache1 := scheduleInfoCache0.GetScheduleInfoCache(topicTalosResourceName0) + scheduleInfoCache1 := scheduleInfoCache0.GetScheduleInfo(topicTalosResourceName0) assert.NotNil(t, scheduleInfoCache1) assert.Equal(t, scheduleInfoCache0, scheduleInfoCache1) - scheduleInfoCache2 := scheduleInfoCache0.GetScheduleInfoCache(topicTalosResourceName1) + scheduleInfoCache2 := scheduleInfoCache0.GetScheduleInfo(topicTalosResourceName1) assert.Nil(t, scheduleInfoCache2) assert.NotEqual(t, scheduleInfoCache0, scheduleInfoCache2) @@ -72,7 +73,8 @@ func TestNewAndGetScheduleInfoCache(t *testing.T) { func TestGetOrCreatMessageClient(t *testing.T) { //log4go.LoadConfiguration("log4go.xml") - defer log4go.Close() + //defer log4go.Close() + var logger log4go.Logger properties := utils.NewProperties() properties.SetProperty("galaxy.talos.service.endpoint", "https://talos.api.xiaomi.com") clientConfig := client.NewTalosClientConfigByProperties(properties) @@ -111,18 +113,18 @@ func TestGetOrCreatMessageClient(t *testing.T) { mockMessageClient2.EXPECT().GetScheduleInfo(gomock.Any()).Return(getScheduleInfoResponse, nil).Times(2) //mockMessageClient3 := mock_message.NewMockMessageService(ctrl) - mockClientFactory := mock_client.NewMockTalosClient(ctrl) + mockClientFactory := mock_client.NewMockTalosClientFactoryInterface(ctrl) mockClientFactory.EXPECT().NewMessageClient("http://" + host0).Return(mockMessageClient1) //mockClientFactory.EXPECT().NewMessageClient("http://" + host1).Return(mockMessageClient2) //mockClientFactory.EXPECT().NewMessageClient("http://" + host2).Return(mockMessageClient3) - scheduleInfoCache := client.NewScheduleInfoCache(topicTalosResourceName1, - clientConfig, mockMessageClient, mockClientFactory) + scheduleInfoCache := client.NewAutoLocationScheduleInfoCache(topicTalosResourceName1, + clientConfig, mockMessageClient, mockClientFactory, &logger) assert.Equal(t, mockMessageClient, scheduleInfoCache.GetOrCreateMessageClient(topicAndPartition0)) assert.Equal(t, mockMessageClient1, scheduleInfoCache.GetOrCreateMessageClient(topicAndPartition1)) - scheduleInfoCache2 := client.NewScheduleInfoCache(topicTalosResourceName1, - clientConfig, mockMessageClient2, mockClientFactory) + scheduleInfoCache2 := client.NewAutoLocationScheduleInfoCache(topicTalosResourceName1, + clientConfig, mockMessageClient2, mockClientFactory, &logger) scheduleInfoCache2.UpdateScheduleInfoCache() } diff --git a/test/client/serialization_test.go b/test/client/serialization_test.go index 07492b7..789c0cb 100644 --- a/test/client/serialization_test.go +++ b/test/client/serialization_test.go @@ -14,11 +14,11 @@ import ( "reflect" - "talos-sdk-golang/thrift/message" + "github.com/XiaoMi/talos-sdk-golang/thrift/message" - "talos-sdk-golang/utils" + "github.com/XiaoMi/talos-sdk-golang/utils" - "talos-sdk-golang/client/serialization" + "github.com/XiaoMi/talos-sdk-golang/client/serialization" "github.com/stretchr/testify/assert" ) diff --git a/test/mock_admin/mock_TalosAdmin.go b/test/mock_admin/mock_TalosAdmin.go index fb1bbad..88f6375 100644 --- a/test/mock_admin/mock_TalosAdmin.go +++ b/test/mock_admin/mock_TalosAdmin.go @@ -7,7 +7,7 @@ package mock_admin import ( reflect "reflect" - topic "talos-sdk-golang/thrift/topic" + topic "github.com/XiaoMi/talos-sdk-golang/thrift/topic" gomock "github.com/golang/mock/gomock" ) diff --git a/test/mock_client/mock_clientFactory.go b/test/mock_client/mock_clientFactory.go index 8b91099..573115d 100644 --- a/test/mock_client/mock_clientFactory.go +++ b/test/mock_client/mock_clientFactory.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: TalosClientFactory.go +// Source: client/TalosClientFactory.go // Package mock_client is a generated GoMock package. package mock_client @@ -7,104 +7,173 @@ package mock_client import ( reflect "reflect" - consumer "talos-sdk-golang/thrift/consumer" - message "talos-sdk-golang/thrift/message" - topic "talos-sdk-golang/thrift/topic" - + consumer "github.com/XiaoMi/talos-sdk-golang/thrift/consumer" + message "github.com/XiaoMi/talos-sdk-golang/thrift/message" + metric "github.com/XiaoMi/talos-sdk-golang/thrift/metric" + quota "github.com/XiaoMi/talos-sdk-golang/thrift/quota" + topic "github.com/XiaoMi/talos-sdk-golang/thrift/topic" gomock "github.com/golang/mock/gomock" ) -// MockTalosClient is a mock of TalosClient interface -type MockTalosClient struct { +// MockTalosClientFactoryInterface is a mock of TalosClientFactoryInterface interface. +type MockTalosClientFactoryInterface struct { ctrl *gomock.Controller - recorder *MockTalosClientMockRecorder + recorder *MockTalosClientFactoryInterfaceMockRecorder } -// MockTalosClientMockRecorder is the mock recorder for MockTalosClient -type MockTalosClientMockRecorder struct { - mock *MockTalosClient +// MockTalosClientFactoryInterfaceMockRecorder is the mock recorder for MockTalosClientFactoryInterface. +type MockTalosClientFactoryInterfaceMockRecorder struct { + mock *MockTalosClientFactoryInterface } -// NewMockTalosClient creates a new mock instance -func NewMockTalosClient(ctrl *gomock.Controller) *MockTalosClient { - mock := &MockTalosClient{ctrl: ctrl} - mock.recorder = &MockTalosClientMockRecorder{mock} +// NewMockTalosClientFactoryInterface creates a new mock instance. +func NewMockTalosClientFactoryInterface(ctrl *gomock.Controller) *MockTalosClientFactoryInterface { + mock := &MockTalosClientFactoryInterface{ctrl: ctrl} + mock.recorder = &MockTalosClientFactoryInterfaceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockTalosClient) EXPECT() *MockTalosClientMockRecorder { +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockTalosClientFactoryInterface) EXPECT() *MockTalosClientFactoryInterfaceMockRecorder { return m.recorder } -// NewTopicClient mocks base method -func (m *MockTalosClient) NewTopicClient(url string) topic.TopicService { - ret := m.ctrl.Call(m, "NewTopicClient", url) - ret0, _ := ret[0].(topic.TopicService) +// NewConsumerClient mocks base method. +func (m *MockTalosClientFactoryInterface) NewConsumerClient(url string) consumer.ConsumerService { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewConsumerClient", url) + ret0, _ := ret[0].(consumer.ConsumerService) return ret0 } -// NewTopicClient indicates an expected call of NewTopicClient -func (mr *MockTalosClientMockRecorder) NewTopicClient(url interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewTopicClient", reflect.TypeOf((*MockTalosClient)(nil).NewTopicClient), url) +// NewConsumerClient indicates an expected call of NewConsumerClient. +func (mr *MockTalosClientFactoryInterfaceMockRecorder) NewConsumerClient(url interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewConsumerClient", reflect.TypeOf((*MockTalosClientFactoryInterface)(nil).NewConsumerClient), url) } -// NewMessageClient mocks base method -func (m *MockTalosClient) NewMessageClient(url string) message.MessageService { +// NewConsumerClientDefault mocks base method. +func (m *MockTalosClientFactoryInterface) NewConsumerClientDefault() consumer.ConsumerService { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewConsumerClientDefault") + ret0, _ := ret[0].(consumer.ConsumerService) + return ret0 +} + +// NewConsumerClientDefault indicates an expected call of NewConsumerClientDefault. +func (mr *MockTalosClientFactoryInterfaceMockRecorder) NewConsumerClientDefault() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewConsumerClientDefault", reflect.TypeOf((*MockTalosClientFactoryInterface)(nil).NewConsumerClientDefault)) +} + +// NewMessageClient mocks base method. +func (m *MockTalosClientFactoryInterface) NewMessageClient(url string) message.MessageService { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "NewMessageClient", url) ret0, _ := ret[0].(message.MessageService) return ret0 } -// NewMessageClient indicates an expected call of NewMessageClient -func (mr *MockTalosClientMockRecorder) NewMessageClient(url interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewMessageClient", reflect.TypeOf((*MockTalosClient)(nil).NewMessageClient), url) +// NewMessageClient indicates an expected call of NewMessageClient. +func (mr *MockTalosClientFactoryInterfaceMockRecorder) NewMessageClient(url interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewMessageClient", reflect.TypeOf((*MockTalosClientFactoryInterface)(nil).NewMessageClient), url) } -// NewConsumerClient mocks base method -func (m *MockTalosClient) NewConsumerClient(url string) consumer.ConsumerService { - ret := m.ctrl.Call(m, "NewConsumerClient", url) - ret0, _ := ret[0].(consumer.ConsumerService) +// NewMessageClientDefault mocks base method. +func (m *MockTalosClientFactoryInterface) NewMessageClientDefault() message.MessageService { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewMessageClientDefault") + ret0, _ := ret[0].(message.MessageService) return ret0 } -// NewConsumerClient indicates an expected call of NewConsumerClient -func (mr *MockTalosClientMockRecorder) NewConsumerClient(url interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewConsumerClient", reflect.TypeOf((*MockTalosClient)(nil).NewConsumerClient), url) +// NewMessageClientDefault indicates an expected call of NewMessageClientDefault. +func (mr *MockTalosClientFactoryInterfaceMockRecorder) NewMessageClientDefault() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewMessageClientDefault", reflect.TypeOf((*MockTalosClientFactoryInterface)(nil).NewMessageClientDefault)) } -// NewTopicClientDefault mocks base method -func (m *MockTalosClient) NewTopicClientDefault() topic.TopicService { - ret := m.ctrl.Call(m, "NewTopicClientDefault") - ret0, _ := ret[0].(topic.TopicService) +// NewMetricClient mocks base method. +func (m *MockTalosClientFactoryInterface) NewMetricClient(url string) metric.MetricService { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewMetricClient", url) + ret0, _ := ret[0].(metric.MetricService) return ret0 } -// NewTopicClientDefault indicates an expected call of NewTopicClientDefault -func (mr *MockTalosClientMockRecorder) NewTopicClientDefault() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewTopicClientDefault", reflect.TypeOf((*MockTalosClient)(nil).NewTopicClientDefault)) +// NewMetricClient indicates an expected call of NewMetricClient. +func (mr *MockTalosClientFactoryInterfaceMockRecorder) NewMetricClient(url interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewMetricClient", reflect.TypeOf((*MockTalosClientFactoryInterface)(nil).NewMetricClient), url) } -// NewMessageClientDefault mocks base method -func (m *MockTalosClient) NewMessageClientDefault() message.MessageService { - ret := m.ctrl.Call(m, "NewMessageClientDefault") - ret0, _ := ret[0].(message.MessageService) +// NewMetricClientDefault mocks base method. +func (m *MockTalosClientFactoryInterface) NewMetricClientDefault() metric.MetricService { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewMetricClientDefault") + ret0, _ := ret[0].(metric.MetricService) return ret0 } -// NewMessageClientDefault indicates an expected call of NewMessageClientDefault -func (mr *MockTalosClientMockRecorder) NewMessageClientDefault() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewMessageClientDefault", reflect.TypeOf((*MockTalosClient)(nil).NewMessageClientDefault)) +// NewMetricClientDefault indicates an expected call of NewMetricClientDefault. +func (mr *MockTalosClientFactoryInterfaceMockRecorder) NewMetricClientDefault() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewMetricClientDefault", reflect.TypeOf((*MockTalosClientFactoryInterface)(nil).NewMetricClientDefault)) } -// NewConsumerClientDefault mocks base method -func (m *MockTalosClient) NewConsumerClientDefault() consumer.ConsumerService { - ret := m.ctrl.Call(m, "NewConsumerClientDefault") - ret0, _ := ret[0].(consumer.ConsumerService) +// NewQuotaClient mocks base method. +func (m *MockTalosClientFactoryInterface) NewQuotaClient(url string) quota.QuotaService { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewQuotaClient", url) + ret0, _ := ret[0].(quota.QuotaService) + return ret0 +} + +// NewQuotaClient indicates an expected call of NewQuotaClient. +func (mr *MockTalosClientFactoryInterfaceMockRecorder) NewQuotaClient(url interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewQuotaClient", reflect.TypeOf((*MockTalosClientFactoryInterface)(nil).NewQuotaClient), url) +} + +// NewQuotaClientDefault mocks base method. +func (m *MockTalosClientFactoryInterface) NewQuotaClientDefault() quota.QuotaService { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewQuotaClientDefault") + ret0, _ := ret[0].(quota.QuotaService) + return ret0 +} + +// NewQuotaClientDefault indicates an expected call of NewQuotaClientDefault. +func (mr *MockTalosClientFactoryInterfaceMockRecorder) NewQuotaClientDefault() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewQuotaClientDefault", reflect.TypeOf((*MockTalosClientFactoryInterface)(nil).NewQuotaClientDefault)) +} + +// NewTopicClient mocks base method. +func (m *MockTalosClientFactoryInterface) NewTopicClient(url string) topic.TopicService { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewTopicClient", url) + ret0, _ := ret[0].(topic.TopicService) + return ret0 +} + +// NewTopicClient indicates an expected call of NewTopicClient. +func (mr *MockTalosClientFactoryInterfaceMockRecorder) NewTopicClient(url interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewTopicClient", reflect.TypeOf((*MockTalosClientFactoryInterface)(nil).NewTopicClient), url) +} + +// NewTopicClientDefault mocks base method. +func (m *MockTalosClientFactoryInterface) NewTopicClientDefault() topic.TopicService { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewTopicClientDefault") + ret0, _ := ret[0].(topic.TopicService) return ret0 } -// NewConsumerClientDefault indicates an expected call of NewConsumerClientDefault -func (mr *MockTalosClientMockRecorder) NewConsumerClientDefault() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewConsumerClientDefault", reflect.TypeOf((*MockTalosClient)(nil).NewConsumerClientDefault)) +// NewTopicClientDefault indicates an expected call of NewTopicClientDefault. +func (mr *MockTalosClientFactoryInterfaceMockRecorder) NewTopicClientDefault() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewTopicClientDefault", reflect.TypeOf((*MockTalosClientFactoryInterface)(nil).NewTopicClientDefault)) } diff --git a/test/mock_client/mock_schedule.go b/test/mock_client/mock_schedule.go index 64623ec..e5c6307 100644 --- a/test/mock_client/mock_schedule.go +++ b/test/mock_client/mock_schedule.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: ScheduleInfoCache.go +// Source: client/ScheduleInfoCache.go // Package mock_client is a generated GoMock package. package mock_client @@ -7,133 +7,96 @@ package mock_client import ( reflect "reflect" - message "talos-sdk-golang/thrift/message" - topic "talos-sdk-golang/thrift/topic" - - x "talos-sdk-golang/client" - + message "github.com/XiaoMi/talos-sdk-golang/thrift/message" + topic "github.com/XiaoMi/talos-sdk-golang/thrift/topic" gomock "github.com/golang/mock/gomock" ) -// MockScheduleInfo is a mock of ScheduleInfo interface -type MockScheduleInfo struct { +// MockScheduleInfoCacheInterface is a mock of ScheduleInfoCacheInterface interface. +type MockScheduleInfoCacheInterface struct { ctrl *gomock.Controller - recorder *MockScheduleInfoMockRecorder + recorder *MockScheduleInfoCacheInterfaceMockRecorder } -// MockScheduleInfoMockRecorder is the mock recorder for MockScheduleInfo -type MockScheduleInfoMockRecorder struct { - mock *MockScheduleInfo +// MockScheduleInfoCacheInterfaceMockRecorder is the mock recorder for MockScheduleInfoCacheInterface. +type MockScheduleInfoCacheInterfaceMockRecorder struct { + mock *MockScheduleInfoCacheInterface } -// NewMockScheduleInfo creates a new mock instance -func NewMockScheduleInfo(ctrl *gomock.Controller) *MockScheduleInfo { - mock := &MockScheduleInfo{ctrl: ctrl} - mock.recorder = &MockScheduleInfoMockRecorder{mock} +// NewMockScheduleInfoCacheInterface creates a new mock instance. +func NewMockScheduleInfoCacheInterface(ctrl *gomock.Controller) *MockScheduleInfoCacheInterface { + mock := &MockScheduleInfoCacheInterface{ctrl: ctrl} + mock.recorder = &MockScheduleInfoCacheInterfaceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockScheduleInfo) EXPECT() *MockScheduleInfoMockRecorder { +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockScheduleInfoCacheInterface) EXPECT() *MockScheduleInfoCacheInterfaceMockRecorder { return m.recorder } -// GetOrCreateMessageClient mocks base method -func (m *MockScheduleInfo) GetOrCreateMessageClient(topicAndPartition *topic.TopicAndPartition) message.MessageService { +// GetOrCreateMessageClient mocks base method. +func (m *MockScheduleInfoCacheInterface) GetOrCreateMessageClient(topicAndPartition *topic.TopicAndPartition) message.MessageService { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetOrCreateMessageClient", topicAndPartition) ret0, _ := ret[0].(message.MessageService) return ret0 } -// GetOrCreateMessageClient indicates an expected call of GetOrCreateMessageClient -func (mr *MockScheduleInfoMockRecorder) GetOrCreateMessageClient(topicAndPartition interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrCreateMessageClient", reflect.TypeOf((*MockScheduleInfo)(nil).GetOrCreateMessageClient), topicAndPartition) -} - -// GetScheduleInfoCache mocks base method -func (m *MockScheduleInfo) GetScheduleInfoCache(topicTalosResourceName *topic.TopicTalosResourceName) *x.ScheduleInfoCache { - ret := m.ctrl.Call(m, "GetScheduleInfoCache", topicTalosResourceName) - ret0, _ := ret[0].(*x.ScheduleInfoCache) - return ret0 -} - -// GetScheduleInfoCache indicates an expected call of GetScheduleInfoCache -func (mr *MockScheduleInfoMockRecorder) GetScheduleInfoCache(topicTalosResourceName interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScheduleInfoCache", reflect.TypeOf((*MockScheduleInfo)(nil).GetScheduleInfoCache), topicTalosResourceName) +// GetOrCreateMessageClient indicates an expected call of GetOrCreateMessageClient. +func (mr *MockScheduleInfoCacheInterfaceMockRecorder) GetOrCreateMessageClient(topicAndPartition interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrCreateMessageClient", reflect.TypeOf((*MockScheduleInfoCacheInterface)(nil).GetOrCreateMessageClient), topicAndPartition) } -// SetIsAutoLocaton mocks base method -func (m *MockScheduleInfo) SetIsAutoLocaton(autoLocation bool) { - m.ctrl.Call(m, "SetIsAutoLocaton", autoLocation) -} - -// SetIsAutoLocaton indicates an expected call of SetIsAutoLocaton -func (mr *MockScheduleInfoMockRecorder) SetIsAutoLocaton(autoLocation interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetIsAutoLocaton", reflect.TypeOf((*MockScheduleInfo)(nil).SetIsAutoLocaton), autoLocation) -} - -// IsAutoLocation mocks base method -func (m *MockScheduleInfo) IsAutoLocation() bool { - ret := m.ctrl.Call(m, "IsAutoLocation") - ret0, _ := ret[0].(bool) +// GetScheduleInfo mocks base method. +func (m *MockScheduleInfoCacheInterface) GetScheduleInfo(name *topic.TopicTalosResourceName) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetScheduleInfo", name) + ret0, _ := ret[0].(error) return ret0 } -// IsAutoLocation indicates an expected call of IsAutoLocation -func (mr *MockScheduleInfoMockRecorder) IsAutoLocation() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAutoLocation", reflect.TypeOf((*MockScheduleInfo)(nil).IsAutoLocation)) +// GetScheduleInfo indicates an expected call of GetScheduleInfo. +func (mr *MockScheduleInfoCacheInterfaceMockRecorder) GetScheduleInfo(name interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScheduleInfo", reflect.TypeOf((*MockScheduleInfoCacheInterface)(nil).GetScheduleInfo), name) } -// GetScheduleInfo mocks base method -func (m *MockScheduleInfo) GetScheduleInfo(name *topic.TopicTalosResourceName) error { - ret := m.ctrl.Call(m, "GetScheduleInfo", name) +// GetScheduleInfoTask mocks base method. +func (m *MockScheduleInfoCacheInterface) GetScheduleInfoTask() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetScheduleInfoTask") ret0, _ := ret[0].(error) return ret0 } -// GetScheduleInfo indicates an expected call of GetScheduleInfo -func (mr *MockScheduleInfoMockRecorder) GetScheduleInfo(name interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScheduleInfo", reflect.TypeOf((*MockScheduleInfo)(nil).GetScheduleInfo), name) +// GetScheduleInfoTask indicates an expected call of GetScheduleInfoTask. +func (mr *MockScheduleInfoCacheInterfaceMockRecorder) GetScheduleInfoTask() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScheduleInfoTask", reflect.TypeOf((*MockScheduleInfoCacheInterface)(nil).GetScheduleInfoTask)) } -// InitGetScheduleInfoTask mocks base method -func (m *MockScheduleInfo) InitGetScheduleInfoTask() { - m.ctrl.Call(m, "InitGetScheduleInfoTask") +// Shutdown mocks base method. +func (m *MockScheduleInfoCacheInterface) Shutdown(topicTalosResourceName *topic.TopicTalosResourceName) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Shutdown", topicTalosResourceName) } -// InitGetScheduleInfoTask indicates an expected call of InitGetScheduleInfoTask -func (mr *MockScheduleInfoMockRecorder) InitGetScheduleInfoTask() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGetScheduleInfoTask", reflect.TypeOf((*MockScheduleInfo)(nil).InitGetScheduleInfoTask)) +// Shutdown indicates an expected call of Shutdown. +func (mr *MockScheduleInfoCacheInterfaceMockRecorder) Shutdown(topicTalosResourceName interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Shutdown", reflect.TypeOf((*MockScheduleInfoCacheInterface)(nil).Shutdown), topicTalosResourceName) } -// UpdateScheduleInfoCache mocks base method -func (m *MockScheduleInfo) UpdateScheduleInfoCache() { +// UpdateScheduleInfoCache mocks base method. +func (m *MockScheduleInfoCacheInterface) UpdateScheduleInfoCache() { + m.ctrl.T.Helper() m.ctrl.Call(m, "UpdateScheduleInfoCache") } -// UpdateScheduleInfoCache indicates an expected call of UpdateScheduleInfoCache -func (mr *MockScheduleInfoMockRecorder) UpdateScheduleInfoCache() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateScheduleInfoCache", reflect.TypeOf((*MockScheduleInfo)(nil).UpdateScheduleInfoCache)) -} - -// GetScheduleInfoTask mocks base method -func (m *MockScheduleInfo) GetScheduleInfoTask() error { - ret := m.ctrl.Call(m, "GetScheduleInfoTask") - ret0, _ := ret[0].(error) - return ret0 -} - -// GetScheduleInfoTask indicates an expected call of GetScheduleInfoTask -func (mr *MockScheduleInfoMockRecorder) GetScheduleInfoTask() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScheduleInfoTask", reflect.TypeOf((*MockScheduleInfo)(nil).GetScheduleInfoTask)) -} - -// Shutdown mocks base method -func (m *MockScheduleInfo) Shutdown(topicTalosResourceName *topic.TopicTalosResourceName) { - m.ctrl.Call(m, "Shutdown", topicTalosResourceName) -} - -// Shutdown indicates an expected call of Shutdown -func (mr *MockScheduleInfoMockRecorder) Shutdown(topicTalosResourceName interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Shutdown", reflect.TypeOf((*MockScheduleInfo)(nil).Shutdown), topicTalosResourceName) +// UpdateScheduleInfoCache indicates an expected call of UpdateScheduleInfoCache. +func (mr *MockScheduleInfoCacheInterfaceMockRecorder) UpdateScheduleInfoCache() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateScheduleInfoCache", reflect.TypeOf((*MockScheduleInfoCacheInterface)(nil).UpdateScheduleInfoCache)) } diff --git a/test/mock_message/mock_message.go b/test/mock_message/mock_message.go index 9eb5913..4dfd518 100644 --- a/test/mock_message/mock_message.go +++ b/test/mock_message/mock_message.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: messageservice.go +// Source: thrift/message/messageservice.go // Package mock_message is a generated GoMock package. package mock_message @@ -7,134 +7,224 @@ package mock_message import ( reflect "reflect" - common "talos-sdk-golang/thrift/common" - x "talos-sdk-golang/thrift/message" - + common "github.com/XiaoMi/talos-sdk-golang/thrift/common" + message "github.com/XiaoMi/talos-sdk-golang/thrift/message" gomock "github.com/golang/mock/gomock" ) -// MockMessageService is a mock of MessageService interface +// MockMessageService is a mock of MessageService interface. type MockMessageService struct { ctrl *gomock.Controller recorder *MockMessageServiceMockRecorder } -// MockMessageServiceMockRecorder is the mock recorder for MockMessageService +// MockMessageServiceMockRecorder is the mock recorder for MockMessageService. type MockMessageServiceMockRecorder struct { mock *MockMessageService } -// NewMockMessageService creates a new mock instance +// NewMockMessageService creates a new mock instance. func NewMockMessageService(ctrl *gomock.Controller) *MockMessageService { mock := &MockMessageService{ctrl: ctrl} mock.recorder = &MockMessageServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockMessageService) EXPECT() *MockMessageServiceMockRecorder { return m.recorder } -// GetServiceVersion mocks base method -func (m *MockMessageService) GetServiceVersion() (*common.Version, error) { - ret := m.ctrl.Call(m, "GetServiceVersion") - ret0, _ := ret[0].(*common.Version) +// Commit mocks base method. +func (m *MockMessageService) Commit(request *message.CommitRequest) (*message.CommitResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Commit", request) + ret0, _ := ret[0].(*message.CommitResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetServiceVersion indicates an expected call of GetServiceVersion -func (mr *MockMessageServiceMockRecorder) GetServiceVersion() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceVersion", reflect.TypeOf((*MockMessageService)(nil).GetServiceVersion)) +// Commit indicates an expected call of Commit. +func (mr *MockMessageServiceMockRecorder) Commit(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Commit", reflect.TypeOf((*MockMessageService)(nil).Commit), request) } -// ValidClientVersion mocks base method -func (m *MockMessageService) ValidClientVersion(clientVersion *common.Version) error { - ret := m.ctrl.Call(m, "ValidClientVersion", clientVersion) - ret0, _ := ret[0].(error) - return ret0 +// GetMessage mocks base method. +func (m *MockMessageService) GetMessage(request *message.GetMessageRequest) (*message.GetMessageResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMessage", request) + ret0, _ := ret[0].(*message.GetMessageResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// ValidClientVersion indicates an expected call of ValidClientVersion -func (mr *MockMessageServiceMockRecorder) ValidClientVersion(clientVersion interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidClientVersion", reflect.TypeOf((*MockMessageService)(nil).ValidClientVersion), clientVersion) +// GetMessage indicates an expected call of GetMessage. +func (mr *MockMessageServiceMockRecorder) GetMessage(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMessage", reflect.TypeOf((*MockMessageService)(nil).GetMessage), request) } -// PutMessage mocks base method -func (m *MockMessageService) PutMessage(request *x.PutMessageRequest) (*x.PutMessageResponse, error) { - ret := m.ctrl.Call(m, "PutMessage", request) - ret0, _ := ret[0].(*x.PutMessageResponse) +// GetPartitionOffset mocks base method. +func (m *MockMessageService) GetPartitionOffset(request *message.GetPartitionOffsetRequest) (*message.GetPartitionOffsetResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPartitionOffset", request) + ret0, _ := ret[0].(*message.GetPartitionOffsetResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// PutMessage indicates an expected call of PutMessage -func (mr *MockMessageServiceMockRecorder) PutMessage(request interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutMessage", reflect.TypeOf((*MockMessageService)(nil).PutMessage), request) +// GetPartitionOffset indicates an expected call of GetPartitionOffset. +func (mr *MockMessageServiceMockRecorder) GetPartitionOffset(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPartitionOffset", reflect.TypeOf((*MockMessageService)(nil).GetPartitionOffset), request) } -// GetMessage mocks base method -func (m *MockMessageService) GetMessage(request *x.GetMessageRequest) (*x.GetMessageResponse, error) { - ret := m.ctrl.Call(m, "GetMessage", request) - ret0, _ := ret[0].(*x.GetMessageResponse) +// GetPartitionsOffset mocks base method. +func (m *MockMessageService) GetPartitionsOffset(request *message.GetPartitionsOffsetRequest) (*message.GetPartitionsOffsetResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPartitionsOffset", request) + ret0, _ := ret[0].(*message.GetPartitionsOffsetResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetMessage indicates an expected call of GetMessage -func (mr *MockMessageServiceMockRecorder) GetMessage(request interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMessage", reflect.TypeOf((*MockMessageService)(nil).GetMessage), request) +// GetPartitionsOffset indicates an expected call of GetPartitionsOffset. +func (mr *MockMessageServiceMockRecorder) GetPartitionsOffset(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPartitionsOffset", reflect.TypeOf((*MockMessageService)(nil).GetPartitionsOffset), request) } -// GetTopicOffset mocks base method -func (m *MockMessageService) GetTopicOffset(request *x.GetTopicOffsetRequest) (*x.GetTopicOffsetResponse, error) { +// GetScheduleInfo mocks base method. +func (m *MockMessageService) GetScheduleInfo(request *message.GetScheduleInfoRequest) (*message.GetScheduleInfoResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetScheduleInfo", request) + ret0, _ := ret[0].(*message.GetScheduleInfoResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetScheduleInfo indicates an expected call of GetScheduleInfo. +func (mr *MockMessageServiceMockRecorder) GetScheduleInfo(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScheduleInfo", reflect.TypeOf((*MockMessageService)(nil).GetScheduleInfo), request) +} + +// GetServiceVersion mocks base method. +func (m *MockMessageService) GetServiceVersion() (*common.Version, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServiceVersion") + ret0, _ := ret[0].(*common.Version) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServiceVersion indicates an expected call of GetServiceVersion. +func (mr *MockMessageServiceMockRecorder) GetServiceVersion() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceVersion", reflect.TypeOf((*MockMessageService)(nil).GetServiceVersion)) +} + +// GetTopicOffset mocks base method. +func (m *MockMessageService) GetTopicOffset(request *message.GetTopicOffsetRequest) (*message.GetTopicOffsetResponse, error) { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTopicOffset", request) - ret0, _ := ret[0].(*x.GetTopicOffsetResponse) + ret0, _ := ret[0].(*message.GetTopicOffsetResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetTopicOffset indicates an expected call of GetTopicOffset +// GetTopicOffset indicates an expected call of GetTopicOffset. func (mr *MockMessageServiceMockRecorder) GetTopicOffset(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTopicOffset", reflect.TypeOf((*MockMessageService)(nil).GetTopicOffset), request) } -// GetPartitionOffset mocks base method -func (m *MockMessageService) GetPartitionOffset(request *x.GetPartitionOffsetRequest) (*x.GetPartitionOffsetResponse, error) { - ret := m.ctrl.Call(m, "GetPartitionOffset", request) - ret0, _ := ret[0].(*x.GetPartitionOffsetResponse) +// GetUnkownStateTransaction mocks base method. +func (m *MockMessageService) GetUnkownStateTransaction(request *message.GetUnkownStateTransactionRequest) (*message.GetUnkownStateTransactionResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUnkownStateTransaction", request) + ret0, _ := ret[0].(*message.GetUnkownStateTransactionResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetPartitionOffset indicates an expected call of GetPartitionOffset -func (mr *MockMessageServiceMockRecorder) GetPartitionOffset(request interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPartitionOffset", reflect.TypeOf((*MockMessageService)(nil).GetPartitionOffset), request) +// GetUnkownStateTransaction indicates an expected call of GetUnkownStateTransaction. +func (mr *MockMessageServiceMockRecorder) GetUnkownStateTransaction(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUnkownStateTransaction", reflect.TypeOf((*MockMessageService)(nil).GetUnkownStateTransaction), request) } -// GetPartitionsOffset mocks base method -func (m *MockMessageService) GetPartitionsOffset(request *x.GetPartitionsOffsetRequest) (*x.GetPartitionsOffsetResponse, error) { - ret := m.ctrl.Call(m, "GetPartitionsOffset", request) - ret0, _ := ret[0].(*x.GetPartitionsOffsetResponse) +// LookupTopics mocks base method. +func (m *MockMessageService) LookupTopics(request *message.LookupTopicsRequest) (*message.LookupTopicsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "LookupTopics", request) + ret0, _ := ret[0].(*message.LookupTopicsResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetPartitionsOffset indicates an expected call of GetPartitionsOffset -func (mr *MockMessageServiceMockRecorder) GetPartitionsOffset(request interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPartitionsOffset", reflect.TypeOf((*MockMessageService)(nil).GetPartitionsOffset), request) +// LookupTopics indicates an expected call of LookupTopics. +func (mr *MockMessageServiceMockRecorder) LookupTopics(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LookupTopics", reflect.TypeOf((*MockMessageService)(nil).LookupTopics), request) } -// GetScheduleInfo mocks base method -func (m *MockMessageService) GetScheduleInfo(request *x.GetScheduleInfoRequest) (*x.GetScheduleInfoResponse, error) { - ret := m.ctrl.Call(m, "GetScheduleInfo", request) - ret0, _ := ret[0].(*x.GetScheduleInfoResponse) +// Prepare mocks base method. +func (m *MockMessageService) Prepare(request *message.PrepareRequest) (*message.PrepareResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Prepare", request) + ret0, _ := ret[0].(*message.PrepareResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetScheduleInfo indicates an expected call of GetScheduleInfo -func (mr *MockMessageServiceMockRecorder) GetScheduleInfo(request interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScheduleInfo", reflect.TypeOf((*MockMessageService)(nil).GetScheduleInfo), request) +// Prepare indicates an expected call of Prepare. +func (mr *MockMessageServiceMockRecorder) Prepare(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Prepare", reflect.TypeOf((*MockMessageService)(nil).Prepare), request) +} + +// PutMessage mocks base method. +func (m *MockMessageService) PutMessage(request *message.PutMessageRequest) (*message.PutMessageResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutMessage", request) + ret0, _ := ret[0].(*message.PutMessageResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutMessage indicates an expected call of PutMessage. +func (mr *MockMessageServiceMockRecorder) PutMessage(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutMessage", reflect.TypeOf((*MockMessageService)(nil).PutMessage), request) +} + +// Rollback mocks base method. +func (m *MockMessageService) Rollback(request *message.RollbackRequest) (*message.RollbackResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Rollback", request) + ret0, _ := ret[0].(*message.RollbackResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Rollback indicates an expected call of Rollback. +func (mr *MockMessageServiceMockRecorder) Rollback(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rollback", reflect.TypeOf((*MockMessageService)(nil).Rollback), request) +} + +// ValidClientVersion mocks base method. +func (m *MockMessageService) ValidClientVersion(clientVersion *common.Version) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidClientVersion", clientVersion) + ret0, _ := ret[0].(error) + return ret0 +} + +// ValidClientVersion indicates an expected call of ValidClientVersion. +func (mr *MockMessageServiceMockRecorder) ValidClientVersion(clientVersion interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidClientVersion", reflect.TypeOf((*MockMessageService)(nil).ValidClientVersion), clientVersion) } diff --git a/test/mock_producer/mock_PartitionSender.go b/test/mock_producer/mock_PartitionSender.go index 42831f3..1a55329 100644 --- a/test/mock_producer/mock_PartitionSender.go +++ b/test/mock_producer/mock_PartitionSender.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: PartitionSender.go +// Source: producer/PartitionSender.go // Package mock_producer is a generated GoMock package. package mock_producer @@ -7,70 +7,77 @@ package mock_producer import ( reflect "reflect" - producer "talos-sdk-golang/producer" - + producer "github.com/XiaoMi/talos-sdk-golang/producer" gomock "github.com/golang/mock/gomock" ) -// MockSender is a mock of Sender interface +// MockSender is a mock of Sender interface. type MockSender struct { ctrl *gomock.Controller recorder *MockSenderMockRecorder } -// MockSenderMockRecorder is the mock recorder for MockSender +// MockSenderMockRecorder is the mock recorder for MockSender. type MockSenderMockRecorder struct { mock *MockSender } -// NewMockSender creates a new mock instance +// NewMockSender creates a new mock instance. func NewMockSender(ctrl *gomock.Controller) *MockSender { mock := &MockSender{ctrl: ctrl} mock.recorder = &MockSenderMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockSender) EXPECT() *MockSenderMockRecorder { return m.recorder } -// AddMessage mocks base method +// AddMessage mocks base method. func (m *MockSender) AddMessage(userMessageList []*producer.UserMessage) { + m.ctrl.T.Helper() m.ctrl.Call(m, "AddMessage", userMessageList) } -// AddMessage indicates an expected call of AddMessage +// AddMessage indicates an expected call of AddMessage. func (mr *MockSenderMockRecorder) AddMessage(userMessageList interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddMessage", reflect.TypeOf((*MockSender)(nil).AddMessage), userMessageList) } -// Shutdown mocks base method -func (m *MockSender) Shutdown() { - m.ctrl.Call(m, "Shutdown") -} - -// Shutdown indicates an expected call of Shutdown -func (mr *MockSenderMockRecorder) Shutdown() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Shutdown", reflect.TypeOf((*MockSender)(nil).Shutdown)) -} - -// MessageCallbackTask mocks base method +// MessageCallbackTask mocks base method. func (m *MockSender) MessageCallbackTask(userMessageResult *producer.UserMessageResult) { + m.ctrl.T.Helper() m.ctrl.Call(m, "MessageCallbackTask", userMessageResult) } -// MessageCallbackTask indicates an expected call of MessageCallbackTask +// MessageCallbackTask indicates an expected call of MessageCallbackTask. func (mr *MockSenderMockRecorder) MessageCallbackTask(userMessageResult interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MessageCallbackTask", reflect.TypeOf((*MockSender)(nil).MessageCallbackTask), userMessageResult) } -// MessageWriterTask mocks base method +// MessageWriterTask mocks base method. func (m *MockSender) MessageWriterTask() { + m.ctrl.T.Helper() m.ctrl.Call(m, "MessageWriterTask") } -// MessageWriterTask indicates an expected call of MessageWriterTask +// MessageWriterTask indicates an expected call of MessageWriterTask. func (mr *MockSenderMockRecorder) MessageWriterTask() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MessageWriterTask", reflect.TypeOf((*MockSender)(nil).MessageWriterTask)) } + +// Shutdown mocks base method. +func (m *MockSender) Shutdown() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Shutdown") +} + +// Shutdown indicates an expected call of Shutdown. +func (mr *MockSenderMockRecorder) Shutdown() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Shutdown", reflect.TypeOf((*MockSender)(nil).Shutdown)) +} diff --git a/test/mock_producer/mock_TalosProducer.go b/test/mock_producer/mock_TalosProducer.go index 13f00e1..12a098b 100644 --- a/test/mock_producer/mock_TalosProducer.go +++ b/test/mock_producer/mock_TalosProducer.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: TalosProducer.go +// Source: producer/TalosProducer.go // Package mock_producer is a generated GoMock package. package mock_producer @@ -7,120 +7,135 @@ package mock_producer import ( reflect "reflect" - message "talos-sdk-golang/thrift/message" - + message "github.com/XiaoMi/talos-sdk-golang/thrift/message" gomock "github.com/golang/mock/gomock" ) -// MockProducer is a mock of Producer interface +// MockProducer is a mock of Producer interface. type MockProducer struct { ctrl *gomock.Controller recorder *MockProducerMockRecorder } -// MockProducerMockRecorder is the mock recorder for MockProducer +// MockProducerMockRecorder is the mock recorder for MockProducer. type MockProducerMockRecorder struct { mock *MockProducer } -// NewMockProducer creates a new mock instance +// NewMockProducer creates a new mock instance. func NewMockProducer(ctrl *gomock.Controller) *MockProducer { mock := &MockProducer{ctrl: ctrl} mock.recorder = &MockProducerMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockProducer) EXPECT() *MockProducerMockRecorder { return m.recorder } -// AddUserMessage mocks base method +// AddUserMessage mocks base method. func (m *MockProducer) AddUserMessage(msgList []*message.Message) error { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AddUserMessage", msgList) ret0, _ := ret[0].(error) return ret0 } -// AddUserMessage indicates an expected call of AddUserMessage +// AddUserMessage indicates an expected call of AddUserMessage. func (mr *MockProducerMockRecorder) AddUserMessage(msgList interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUserMessage", reflect.TypeOf((*MockProducer)(nil).AddUserMessage), msgList) } -// DoAddUserMessage mocks base method +// CheckPartitionTask mocks base method. +func (m *MockProducer) CheckPartitionTask() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "CheckPartitionTask") +} + +// CheckPartitionTask indicates an expected call of CheckPartitionTask. +func (mr *MockProducerMockRecorder) CheckPartitionTask() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckPartitionTask", reflect.TypeOf((*MockProducer)(nil).CheckPartitionTask)) +} + +// DecreaseBufferedCount mocks base method. +func (m *MockProducer) DecreaseBufferedCount(decrementNumber, decrementBytes int64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "DecreaseBufferedCount", decrementNumber, decrementBytes) +} + +// DecreaseBufferedCount indicates an expected call of DecreaseBufferedCount. +func (mr *MockProducerMockRecorder) DecreaseBufferedCount(decrementNumber, decrementBytes interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DecreaseBufferedCount", reflect.TypeOf((*MockProducer)(nil).DecreaseBufferedCount), decrementNumber, decrementBytes) +} + +// DoAddUserMessage mocks base method. func (m *MockProducer) DoAddUserMessage(msgList []*message.Message) error { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DoAddUserMessage", msgList) ret0, _ := ret[0].(error) return ret0 } -// DoAddUserMessage indicates an expected call of DoAddUserMessage +// DoAddUserMessage indicates an expected call of DoAddUserMessage. func (mr *MockProducerMockRecorder) DoAddUserMessage(msgList interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DoAddUserMessage", reflect.TypeOf((*MockProducer)(nil).DoAddUserMessage), msgList) } -// IsActive mocks base method +// IncreaseBufferedCount mocks base method. +func (m *MockProducer) IncreaseBufferedCount(incrementNumber, incrementBytes int64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "IncreaseBufferedCount", incrementNumber, incrementBytes) +} + +// IncreaseBufferedCount indicates an expected call of IncreaseBufferedCount. +func (mr *MockProducerMockRecorder) IncreaseBufferedCount(incrementNumber, incrementBytes interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IncreaseBufferedCount", reflect.TypeOf((*MockProducer)(nil).IncreaseBufferedCount), incrementNumber, incrementBytes) +} + +// IsActive mocks base method. func (m *MockProducer) IsActive() bool { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "IsActive") ret0, _ := ret[0].(bool) return ret0 } -// IsActive indicates an expected call of IsActive +// IsActive indicates an expected call of IsActive. func (mr *MockProducerMockRecorder) IsActive() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsActive", reflect.TypeOf((*MockProducer)(nil).IsActive)) } -// IsDisable mocks base method +// IsDisable mocks base method. func (m *MockProducer) IsDisable() bool { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "IsDisable") ret0, _ := ret[0].(bool) return ret0 } -// IsDisable indicates an expected call of IsDisable +// IsDisable indicates an expected call of IsDisable. func (mr *MockProducerMockRecorder) IsDisable() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDisable", reflect.TypeOf((*MockProducer)(nil).IsDisable)) } -// IsShutdown mocks base method +// IsShutdown mocks base method. func (m *MockProducer) IsShutdown() bool { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "IsShutdown") ret0, _ := ret[0].(bool) return ret0 } -// IsShutdown indicates an expected call of IsShutdown +// IsShutdown indicates an expected call of IsShutdown. func (mr *MockProducerMockRecorder) IsShutdown() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsShutdown", reflect.TypeOf((*MockProducer)(nil).IsShutdown)) } - -// IncreaseBufferedCount mocks base method -func (m *MockProducer) IncreaseBufferedCount(incrementNumber, incrementBytes int64) { - m.ctrl.Call(m, "IncreaseBufferedCount", incrementNumber, incrementBytes) -} - -// IncreaseBufferedCount indicates an expected call of IncreaseBufferedCount -func (mr *MockProducerMockRecorder) IncreaseBufferedCount(incrementNumber, incrementBytes interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IncreaseBufferedCount", reflect.TypeOf((*MockProducer)(nil).IncreaseBufferedCount), incrementNumber, incrementBytes) -} - -// DecreaseBufferedCount mocks base method -func (m *MockProducer) DecreaseBufferedCount(decrementNumber, decrementBytes int64) { - m.ctrl.Call(m, "DecreaseBufferedCount", decrementNumber, decrementBytes) -} - -// DecreaseBufferedCount indicates an expected call of DecreaseBufferedCount -func (mr *MockProducerMockRecorder) DecreaseBufferedCount(decrementNumber, decrementBytes interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DecreaseBufferedCount", reflect.TypeOf((*MockProducer)(nil).DecreaseBufferedCount), decrementNumber, decrementBytes) -} - -// CheckPartitionTask mocks base method -func (m *MockProducer) CheckPartitionTask() { - m.ctrl.Call(m, "CheckPartitionTask") -} - -// CheckPartitionTask indicates an expected call of CheckPartitionTask -func (mr *MockProducerMockRecorder) CheckPartitionTask() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckPartitionTask", reflect.TypeOf((*MockProducer)(nil).CheckPartitionTask)) -} diff --git a/thrift/message/constants.go b/thrift/message/constants.go index 7aed2a8..9a65fe8 100644 --- a/thrift/message/constants.go +++ b/thrift/message/constants.go @@ -6,7 +6,6 @@ package message import ( "bytes" "fmt" - "github.com/XiaoMi/talos-sdk-golang/thrift/common" "github.com/XiaoMi/talos-sdk-golang/thrift/thrift" "github.com/XiaoMi/talos-sdk-golang/thrift/topic" diff --git a/thrift/message/message_service-remote/message_service-remote.go b/thrift/message/message_service-remote/message_service-remote.go index 1bf448b..06c0896 100755 --- a/thrift/message/message_service-remote/message_service-remote.go +++ b/thrift/message/message_service-remote/message_service-remote.go @@ -6,6 +6,7 @@ package main import ( "flag" "fmt" + "github.com/XiaoMi/talos-sdk-golang/thrift/thrift" "math" "net" "net/url" @@ -13,8 +14,6 @@ import ( "strconv" "strings" "thrift/message" - - "github.com/XiaoMi/talos-sdk-golang/thrift/thrift" ) func Usage() { @@ -133,19 +132,19 @@ func main() { fmt.Fprintln(os.Stderr, "PutMessage requires 1 args") flag.Usage() } - arg35 := flag.Arg(1) - mbTrans36 := thrift.NewTMemoryBufferLen(len(arg35)) - defer mbTrans36.Close() - _, err37 := mbTrans36.WriteString(arg35) - if err37 != nil { + arg37 := flag.Arg(1) + mbTrans38 := thrift.NewTMemoryBufferLen(len(arg37)) + defer mbTrans38.Close() + _, err39 := mbTrans38.WriteString(arg37) + if err39 != nil { Usage() return } - factory38 := thrift.NewTSimpleJSONProtocolFactory() - jsProt39 := factory38.GetProtocol(mbTrans36) + factory40 := thrift.NewTSimpleJSONProtocolFactory() + jsProt41 := factory40.GetProtocol(mbTrans38) argvalue0 := message.NewPutMessageRequest() - err40 := argvalue0.Read(jsProt39) - if err40 != nil { + err42 := argvalue0.Read(jsProt41) + if err42 != nil { Usage() return } @@ -158,19 +157,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetMessage requires 1 args") flag.Usage() } - arg41 := flag.Arg(1) - mbTrans42 := thrift.NewTMemoryBufferLen(len(arg41)) - defer mbTrans42.Close() - _, err43 := mbTrans42.WriteString(arg41) - if err43 != nil { + arg43 := flag.Arg(1) + mbTrans44 := thrift.NewTMemoryBufferLen(len(arg43)) + defer mbTrans44.Close() + _, err45 := mbTrans44.WriteString(arg43) + if err45 != nil { Usage() return } - factory44 := thrift.NewTSimpleJSONProtocolFactory() - jsProt45 := factory44.GetProtocol(mbTrans42) + factory46 := thrift.NewTSimpleJSONProtocolFactory() + jsProt47 := factory46.GetProtocol(mbTrans44) argvalue0 := message.NewGetMessageRequest() - err46 := argvalue0.Read(jsProt45) - if err46 != nil { + err48 := argvalue0.Read(jsProt47) + if err48 != nil { Usage() return } @@ -183,19 +182,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTopicOffset requires 1 args") flag.Usage() } - arg47 := flag.Arg(1) - mbTrans48 := thrift.NewTMemoryBufferLen(len(arg47)) - defer mbTrans48.Close() - _, err49 := mbTrans48.WriteString(arg47) - if err49 != nil { + arg49 := flag.Arg(1) + mbTrans50 := thrift.NewTMemoryBufferLen(len(arg49)) + defer mbTrans50.Close() + _, err51 := mbTrans50.WriteString(arg49) + if err51 != nil { Usage() return } - factory50 := thrift.NewTSimpleJSONProtocolFactory() - jsProt51 := factory50.GetProtocol(mbTrans48) + factory52 := thrift.NewTSimpleJSONProtocolFactory() + jsProt53 := factory52.GetProtocol(mbTrans50) argvalue0 := message.NewGetTopicOffsetRequest() - err52 := argvalue0.Read(jsProt51) - if err52 != nil { + err54 := argvalue0.Read(jsProt53) + if err54 != nil { Usage() return } @@ -208,19 +207,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetPartitionOffset requires 1 args") flag.Usage() } - arg53 := flag.Arg(1) - mbTrans54 := thrift.NewTMemoryBufferLen(len(arg53)) - defer mbTrans54.Close() - _, err55 := mbTrans54.WriteString(arg53) - if err55 != nil { + arg55 := flag.Arg(1) + mbTrans56 := thrift.NewTMemoryBufferLen(len(arg55)) + defer mbTrans56.Close() + _, err57 := mbTrans56.WriteString(arg55) + if err57 != nil { Usage() return } - factory56 := thrift.NewTSimpleJSONProtocolFactory() - jsProt57 := factory56.GetProtocol(mbTrans54) + factory58 := thrift.NewTSimpleJSONProtocolFactory() + jsProt59 := factory58.GetProtocol(mbTrans56) argvalue0 := message.NewGetPartitionOffsetRequest() - err58 := argvalue0.Read(jsProt57) - if err58 != nil { + err60 := argvalue0.Read(jsProt59) + if err60 != nil { Usage() return } @@ -233,19 +232,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetPartitionsOffset requires 1 args") flag.Usage() } - arg59 := flag.Arg(1) - mbTrans60 := thrift.NewTMemoryBufferLen(len(arg59)) - defer mbTrans60.Close() - _, err61 := mbTrans60.WriteString(arg59) - if err61 != nil { + arg61 := flag.Arg(1) + mbTrans62 := thrift.NewTMemoryBufferLen(len(arg61)) + defer mbTrans62.Close() + _, err63 := mbTrans62.WriteString(arg61) + if err63 != nil { Usage() return } - factory62 := thrift.NewTSimpleJSONProtocolFactory() - jsProt63 := factory62.GetProtocol(mbTrans60) + factory64 := thrift.NewTSimpleJSONProtocolFactory() + jsProt65 := factory64.GetProtocol(mbTrans62) argvalue0 := message.NewGetPartitionsOffsetRequest() - err64 := argvalue0.Read(jsProt63) - if err64 != nil { + err66 := argvalue0.Read(jsProt65) + if err66 != nil { Usage() return } @@ -258,19 +257,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetScheduleInfo requires 1 args") flag.Usage() } - arg65 := flag.Arg(1) - mbTrans66 := thrift.NewTMemoryBufferLen(len(arg65)) - defer mbTrans66.Close() - _, err67 := mbTrans66.WriteString(arg65) - if err67 != nil { + arg67 := flag.Arg(1) + mbTrans68 := thrift.NewTMemoryBufferLen(len(arg67)) + defer mbTrans68.Close() + _, err69 := mbTrans68.WriteString(arg67) + if err69 != nil { Usage() return } - factory68 := thrift.NewTSimpleJSONProtocolFactory() - jsProt69 := factory68.GetProtocol(mbTrans66) + factory70 := thrift.NewTSimpleJSONProtocolFactory() + jsProt71 := factory70.GetProtocol(mbTrans68) argvalue0 := message.NewGetScheduleInfoRequest() - err70 := argvalue0.Read(jsProt69) - if err70 != nil { + err72 := argvalue0.Read(jsProt71) + if err72 != nil { Usage() return } @@ -283,19 +282,19 @@ func main() { fmt.Fprintln(os.Stderr, "Prepare requires 1 args") flag.Usage() } - arg71 := flag.Arg(1) - mbTrans72 := thrift.NewTMemoryBufferLen(len(arg71)) - defer mbTrans72.Close() - _, err73 := mbTrans72.WriteString(arg71) - if err73 != nil { + arg73 := flag.Arg(1) + mbTrans74 := thrift.NewTMemoryBufferLen(len(arg73)) + defer mbTrans74.Close() + _, err75 := mbTrans74.WriteString(arg73) + if err75 != nil { Usage() return } - factory74 := thrift.NewTSimpleJSONProtocolFactory() - jsProt75 := factory74.GetProtocol(mbTrans72) + factory76 := thrift.NewTSimpleJSONProtocolFactory() + jsProt77 := factory76.GetProtocol(mbTrans74) argvalue0 := message.NewPrepareRequest() - err76 := argvalue0.Read(jsProt75) - if err76 != nil { + err78 := argvalue0.Read(jsProt77) + if err78 != nil { Usage() return } @@ -308,19 +307,19 @@ func main() { fmt.Fprintln(os.Stderr, "Commit requires 1 args") flag.Usage() } - arg77 := flag.Arg(1) - mbTrans78 := thrift.NewTMemoryBufferLen(len(arg77)) - defer mbTrans78.Close() - _, err79 := mbTrans78.WriteString(arg77) - if err79 != nil { + arg79 := flag.Arg(1) + mbTrans80 := thrift.NewTMemoryBufferLen(len(arg79)) + defer mbTrans80.Close() + _, err81 := mbTrans80.WriteString(arg79) + if err81 != nil { Usage() return } - factory80 := thrift.NewTSimpleJSONProtocolFactory() - jsProt81 := factory80.GetProtocol(mbTrans78) + factory82 := thrift.NewTSimpleJSONProtocolFactory() + jsProt83 := factory82.GetProtocol(mbTrans80) argvalue0 := message.NewCommitRequest() - err82 := argvalue0.Read(jsProt81) - if err82 != nil { + err84 := argvalue0.Read(jsProt83) + if err84 != nil { Usage() return } @@ -333,19 +332,19 @@ func main() { fmt.Fprintln(os.Stderr, "Rollback requires 1 args") flag.Usage() } - arg83 := flag.Arg(1) - mbTrans84 := thrift.NewTMemoryBufferLen(len(arg83)) - defer mbTrans84.Close() - _, err85 := mbTrans84.WriteString(arg83) - if err85 != nil { + arg85 := flag.Arg(1) + mbTrans86 := thrift.NewTMemoryBufferLen(len(arg85)) + defer mbTrans86.Close() + _, err87 := mbTrans86.WriteString(arg85) + if err87 != nil { Usage() return } - factory86 := thrift.NewTSimpleJSONProtocolFactory() - jsProt87 := factory86.GetProtocol(mbTrans84) + factory88 := thrift.NewTSimpleJSONProtocolFactory() + jsProt89 := factory88.GetProtocol(mbTrans86) argvalue0 := message.NewRollbackRequest() - err88 := argvalue0.Read(jsProt87) - if err88 != nil { + err90 := argvalue0.Read(jsProt89) + if err90 != nil { Usage() return } @@ -358,19 +357,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetUnkownStateTransaction requires 1 args") flag.Usage() } - arg89 := flag.Arg(1) - mbTrans90 := thrift.NewTMemoryBufferLen(len(arg89)) - defer mbTrans90.Close() - _, err91 := mbTrans90.WriteString(arg89) - if err91 != nil { + arg91 := flag.Arg(1) + mbTrans92 := thrift.NewTMemoryBufferLen(len(arg91)) + defer mbTrans92.Close() + _, err93 := mbTrans92.WriteString(arg91) + if err93 != nil { Usage() return } - factory92 := thrift.NewTSimpleJSONProtocolFactory() - jsProt93 := factory92.GetProtocol(mbTrans90) + factory94 := thrift.NewTSimpleJSONProtocolFactory() + jsProt95 := factory94.GetProtocol(mbTrans92) argvalue0 := message.NewGetUnkownStateTransactionRequest() - err94 := argvalue0.Read(jsProt93) - if err94 != nil { + err96 := argvalue0.Read(jsProt95) + if err96 != nil { Usage() return } @@ -383,19 +382,19 @@ func main() { fmt.Fprintln(os.Stderr, "LookupTopics requires 1 args") flag.Usage() } - arg95 := flag.Arg(1) - mbTrans96 := thrift.NewTMemoryBufferLen(len(arg95)) - defer mbTrans96.Close() - _, err97 := mbTrans96.WriteString(arg95) - if err97 != nil { + arg97 := flag.Arg(1) + mbTrans98 := thrift.NewTMemoryBufferLen(len(arg97)) + defer mbTrans98.Close() + _, err99 := mbTrans98.WriteString(arg97) + if err99 != nil { Usage() return } - factory98 := thrift.NewTSimpleJSONProtocolFactory() - jsProt99 := factory98.GetProtocol(mbTrans96) + factory100 := thrift.NewTSimpleJSONProtocolFactory() + jsProt101 := factory100.GetProtocol(mbTrans98) argvalue0 := message.NewLookupTopicsRequest() - err100 := argvalue0.Read(jsProt99) - if err100 != nil { + err102 := argvalue0.Read(jsProt101) + if err102 != nil { Usage() return } @@ -416,19 +415,19 @@ func main() { fmt.Fprintln(os.Stderr, "ValidClientVersion requires 1 args") flag.Usage() } - arg101 := flag.Arg(1) - mbTrans102 := thrift.NewTMemoryBufferLen(len(arg101)) - defer mbTrans102.Close() - _, err103 := mbTrans102.WriteString(arg101) - if err103 != nil { + arg103 := flag.Arg(1) + mbTrans104 := thrift.NewTMemoryBufferLen(len(arg103)) + defer mbTrans104.Close() + _, err105 := mbTrans104.WriteString(arg103) + if err105 != nil { Usage() return } - factory104 := thrift.NewTSimpleJSONProtocolFactory() - jsProt105 := factory104.GetProtocol(mbTrans102) + factory106 := thrift.NewTSimpleJSONProtocolFactory() + jsProt107 := factory106.GetProtocol(mbTrans104) argvalue0 := message.NewVersion() - err106 := argvalue0.Read(jsProt105) - if err106 != nil { + err108 := argvalue0.Read(jsProt107) + if err108 != nil { Usage() return } diff --git a/thrift/message/messageservice.go b/thrift/message/messageservice.go index 8d16957..b581b42 100644 --- a/thrift/message/messageservice.go +++ b/thrift/message/messageservice.go @@ -6,7 +6,6 @@ package message import ( "bytes" "fmt" - "github.com/XiaoMi/talos-sdk-golang/thrift/common" "github.com/XiaoMi/talos-sdk-golang/thrift/thrift" "github.com/XiaoMi/talos-sdk-golang/thrift/topic" @@ -149,16 +148,16 @@ func (p *MessageServiceClient) recvPutMessage() (value *PutMessageResponse, err return } if mTypeId == thrift.EXCEPTION { - error12 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error13 error - error13, err = error12.Read(iprot) + error14 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error15 error + error15, err = error14.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error13 + err = error15 return } if p.SeqId != seqId { @@ -225,16 +224,16 @@ func (p *MessageServiceClient) recvGetMessage() (value *GetMessageResponse, err return } if mTypeId == thrift.EXCEPTION { - error14 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error15 error - error15, err = error14.Read(iprot) + error16 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error17 error + error17, err = error16.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error15 + err = error17 return } if p.SeqId != seqId { @@ -302,16 +301,16 @@ func (p *MessageServiceClient) recvGetTopicOffset() (value *GetTopicOffsetRespon return } if mTypeId == thrift.EXCEPTION { - error16 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error17 error - error17, err = error16.Read(iprot) + error18 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error19 error + error19, err = error18.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error17 + err = error19 return } if p.SeqId != seqId { @@ -378,16 +377,16 @@ func (p *MessageServiceClient) recvGetPartitionOffset() (value *GetPartitionOffs return } if mTypeId == thrift.EXCEPTION { - error18 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error19 error - error19, err = error18.Read(iprot) + error20 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error21 error + error21, err = error20.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error19 + err = error21 return } if p.SeqId != seqId { @@ -401,6 +400,10 @@ func (p *MessageServiceClient) recvGetPartitionOffset() (value *GetPartitionOffs if err = iprot.ReadMessageEnd(); err != nil { return } + if result.E != nil { + err = result.E + return + } value = result.GetSuccess() return } @@ -450,16 +453,16 @@ func (p *MessageServiceClient) recvGetPartitionsOffset() (value *GetPartitionsOf return } if mTypeId == thrift.EXCEPTION { - error20 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error21 error - error21, err = error20.Read(iprot) + error22 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error23 error + error23, err = error22.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error21 + err = error23 return } if p.SeqId != seqId { @@ -522,16 +525,16 @@ func (p *MessageServiceClient) recvGetScheduleInfo() (value *GetScheduleInfoResp return } if mTypeId == thrift.EXCEPTION { - error22 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error23 error - error23, err = error22.Read(iprot) + error24 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error25 error + error25, err = error24.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error23 + err = error25 return } if p.SeqId != seqId { @@ -598,16 +601,16 @@ func (p *MessageServiceClient) recvPrepare() (value *PrepareResponse, err error) return } if mTypeId == thrift.EXCEPTION { - error24 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error25 error - error25, err = error24.Read(iprot) + error26 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error27 error + error27, err = error26.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error25 + err = error27 return } if p.SeqId != seqId { @@ -674,16 +677,16 @@ func (p *MessageServiceClient) recvCommit() (value *CommitResponse, err error) { return } if mTypeId == thrift.EXCEPTION { - error26 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error27 error - error27, err = error26.Read(iprot) + error28 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error29 error + error29, err = error28.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error27 + err = error29 return } if p.SeqId != seqId { @@ -750,16 +753,16 @@ func (p *MessageServiceClient) recvRollback() (value *RollbackResponse, err erro return } if mTypeId == thrift.EXCEPTION { - error28 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error29 error - error29, err = error28.Read(iprot) + error30 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error31 error + error31, err = error30.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error29 + err = error31 return } if p.SeqId != seqId { @@ -826,16 +829,16 @@ func (p *MessageServiceClient) recvGetUnkownStateTransaction() (value *GetUnkown return } if mTypeId == thrift.EXCEPTION { - error30 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error31 error - error31, err = error30.Read(iprot) + error32 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error33 error + error33, err = error32.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error31 + err = error33 return } if p.SeqId != seqId { @@ -902,16 +905,16 @@ func (p *MessageServiceClient) recvLookupTopics() (value *LookupTopicsResponse, return } if mTypeId == thrift.EXCEPTION { - error32 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error33 error - error33, err = error32.Read(iprot) + error34 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error35 error + error35, err = error34.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error33 + err = error35 return } if p.SeqId != seqId { @@ -938,19 +941,19 @@ type MessageServiceProcessor struct { } func NewMessageServiceProcessor(handler MessageService) *MessageServiceProcessor { - self34 := &MessageServiceProcessor{common.NewTalosBaseServiceProcessor(handler)} - self34.AddToProcessorMap("putMessage", &messageServiceProcessorPutMessage{handler: handler}) - self34.AddToProcessorMap("getMessage", &messageServiceProcessorGetMessage{handler: handler}) - self34.AddToProcessorMap("getTopicOffset", &messageServiceProcessorGetTopicOffset{handler: handler}) - self34.AddToProcessorMap("getPartitionOffset", &messageServiceProcessorGetPartitionOffset{handler: handler}) - self34.AddToProcessorMap("getPartitionsOffset", &messageServiceProcessorGetPartitionsOffset{handler: handler}) - self34.AddToProcessorMap("getScheduleInfo", &messageServiceProcessorGetScheduleInfo{handler: handler}) - self34.AddToProcessorMap("prepare", &messageServiceProcessorPrepare{handler: handler}) - self34.AddToProcessorMap("commit", &messageServiceProcessorCommit{handler: handler}) - self34.AddToProcessorMap("rollback", &messageServiceProcessorRollback{handler: handler}) - self34.AddToProcessorMap("getUnkownStateTransaction", &messageServiceProcessorGetUnkownStateTransaction{handler: handler}) - self34.AddToProcessorMap("lookupTopics", &messageServiceProcessorLookupTopics{handler: handler}) - return self34 + self36 := &MessageServiceProcessor{common.NewTalosBaseServiceProcessor(handler)} + self36.AddToProcessorMap("putMessage", &messageServiceProcessorPutMessage{handler: handler}) + self36.AddToProcessorMap("getMessage", &messageServiceProcessorGetMessage{handler: handler}) + self36.AddToProcessorMap("getTopicOffset", &messageServiceProcessorGetTopicOffset{handler: handler}) + self36.AddToProcessorMap("getPartitionOffset", &messageServiceProcessorGetPartitionOffset{handler: handler}) + self36.AddToProcessorMap("getPartitionsOffset", &messageServiceProcessorGetPartitionsOffset{handler: handler}) + self36.AddToProcessorMap("getScheduleInfo", &messageServiceProcessorGetScheduleInfo{handler: handler}) + self36.AddToProcessorMap("prepare", &messageServiceProcessorPrepare{handler: handler}) + self36.AddToProcessorMap("commit", &messageServiceProcessorCommit{handler: handler}) + self36.AddToProcessorMap("rollback", &messageServiceProcessorRollback{handler: handler}) + self36.AddToProcessorMap("getUnkownStateTransaction", &messageServiceProcessorGetUnkownStateTransaction{handler: handler}) + self36.AddToProcessorMap("lookupTopics", &messageServiceProcessorLookupTopics{handler: handler}) + return self36 } type messageServiceProcessorPutMessage struct { @@ -1133,12 +1136,17 @@ func (p *messageServiceProcessorGetPartitionOffset) Process(seqId int32, iprot, var retval *GetPartitionOffsetResponse var err2 error if retval, err2 = p.handler.GetPartitionOffset(args.Request); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getPartitionOffset: "+err2.Error()) - oprot.WriteMessageBegin("getPartitionOffset", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 + switch v := err2.(type) { + case *common.GalaxyTalosException: + result.E = v + default: + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getPartitionOffset: "+err2.Error()) + oprot.WriteMessageBegin("getPartitionOffset", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, err2 + } } else { result.Success = retval } @@ -2345,7 +2353,8 @@ func (p *GetPartitionOffsetArgs) String() string { } type GetPartitionOffsetResult struct { - Success *GetPartitionOffsetResponse `thrift:"success,0" json:"success"` + Success *GetPartitionOffsetResponse `thrift:"success,0" json:"success"` + E *common.GalaxyTalosException `thrift:"e,1" json:"e"` } func NewGetPartitionOffsetResult() *GetPartitionOffsetResult { @@ -2360,10 +2369,23 @@ func (p *GetPartitionOffsetResult) GetSuccess() *GetPartitionOffsetResponse { } return p.Success } + +var GetPartitionOffsetResult_E_DEFAULT *common.GalaxyTalosException + +func (p *GetPartitionOffsetResult) GetE() *common.GalaxyTalosException { + if !p.IsSetE() { + return GetPartitionOffsetResult_E_DEFAULT + } + return p.E +} func (p *GetPartitionOffsetResult) IsSetSuccess() bool { return p.Success != nil } +func (p *GetPartitionOffsetResult) IsSetE() bool { + return p.E != nil +} + func (p *GetPartitionOffsetResult) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return fmt.Errorf("%T read error: %s", p, err) @@ -2381,6 +2403,10 @@ func (p *GetPartitionOffsetResult) Read(iprot thrift.TProtocol) error { if err := p.ReadField0(iprot); err != nil { return err } + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } default: if err := iprot.Skip(fieldTypeId); err != nil { return err @@ -2404,6 +2430,14 @@ func (p *GetPartitionOffsetResult) ReadField0(iprot thrift.TProtocol) error { return nil } +func (p *GetPartitionOffsetResult) ReadField1(iprot thrift.TProtocol) error { + p.E = &common.GalaxyTalosException{} + if err := p.E.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", p.E, err) + } + return nil +} + func (p *GetPartitionOffsetResult) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("getPartitionOffset_result"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) @@ -2411,6 +2445,9 @@ func (p *GetPartitionOffsetResult) Write(oprot thrift.TProtocol) error { if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField1(oprot); err != nil { + return err + } if err := oprot.WriteFieldStop(); err != nil { return fmt.Errorf("write field stop error: %s", err) } @@ -2435,6 +2472,21 @@ func (p *GetPartitionOffsetResult) writeField0(oprot thrift.TProtocol) (err erro return err } +func (p *GetPartitionOffsetResult) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetE() { + if err := oprot.WriteFieldBegin("e", thrift.STRUCT, 1); err != nil { + return fmt.Errorf("%T write field begin error 1:e: %s", p, err) + } + if err := p.E.Write(oprot); err != nil { + return fmt.Errorf("%T error writing struct: %s", p.E, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 1:e: %s", p, err) + } + } + return err +} + func (p *GetPartitionOffsetResult) String() string { if p == nil { return "" diff --git a/thrift/message/ttypes.go b/thrift/message/ttypes.go index 8061a67..d7828bc 100644 --- a/thrift/message/ttypes.go +++ b/thrift/message/ttypes.go @@ -6,7 +6,6 @@ package message import ( "bytes" "fmt" - "github.com/XiaoMi/talos-sdk-golang/thrift/common" "github.com/XiaoMi/talos-sdk-golang/thrift/thrift" "github.com/XiaoMi/talos-sdk-golang/thrift/topic" @@ -100,6 +99,8 @@ const ( MessageCompressionType_NONE MessageCompressionType = 0 MessageCompressionType_SNAPPY MessageCompressionType = 1 MessageCompressionType_GZIP MessageCompressionType = 2 + MessageCompressionType_ZSTD MessageCompressionType = 3 + MessageCompressionType_LZ4 MessageCompressionType = 4 ) func (p MessageCompressionType) String() string { @@ -110,6 +111,10 @@ func (p MessageCompressionType) String() string { return "MessageCompressionType_SNAPPY" case MessageCompressionType_GZIP: return "MessageCompressionType_GZIP" + case MessageCompressionType_ZSTD: + return "MessageCompressionType_ZSTD" + case MessageCompressionType_LZ4: + return "MessageCompressionType_LZ4" } return "" } @@ -122,6 +127,10 @@ func MessageCompressionTypeFromString(s string) (MessageCompressionType, error) return MessageCompressionType_SNAPPY, nil case "MessageCompressionType_GZIP": return MessageCompressionType_GZIP, nil + case "MessageCompressionType_ZSTD": + return MessageCompressionType_ZSTD, nil + case "MessageCompressionType_LZ4": + return MessageCompressionType_LZ4, nil } return MessageCompressionType(0), fmt.Errorf("not a valid MessageCompressionType string") } @@ -136,6 +145,7 @@ type Message struct { AppendTimestamp *int64 `thrift:"appendTimestamp,5" json:"appendTimestamp"` MessageType *MessageType `thrift:"messageType,6" json:"messageType"` SchemaFingerprint *string `thrift:"SchemaFingerprint,7" json:"SchemaFingerprint"` + Tag *string `thrift:"tag,8" json:"tag"` } func NewMessage() *Message { @@ -199,6 +209,15 @@ func (p *Message) GetSchemaFingerprint() string { } return *p.SchemaFingerprint } + +var Message_Tag_DEFAULT string + +func (p *Message) GetTag() string { + if !p.IsSetTag() { + return Message_Tag_DEFAULT + } + return *p.Tag +} func (p *Message) IsSetPartitionKey() bool { return p.PartitionKey != nil } @@ -223,6 +242,10 @@ func (p *Message) IsSetSchemaFingerprint() bool { return p.SchemaFingerprint != nil } +func (p *Message) IsSetTag() bool { + return p.Tag != nil +} + func (p *Message) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return fmt.Errorf("%T read error: %s", p, err) @@ -264,6 +287,10 @@ func (p *Message) Read(iprot thrift.TProtocol) error { if err := p.ReadField7(iprot); err != nil { return err } + case 8: + if err := p.ReadField8(iprot); err != nil { + return err + } default: if err := iprot.Skip(fieldTypeId); err != nil { return err @@ -343,6 +370,15 @@ func (p *Message) ReadField7(iprot thrift.TProtocol) error { return nil } +func (p *Message) ReadField8(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return fmt.Errorf("error reading field 8: %s", err) + } else { + p.Tag = &v + } + return nil +} + func (p *Message) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("Message"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) @@ -368,6 +404,9 @@ func (p *Message) Write(oprot thrift.TProtocol) error { if err := p.writeField7(oprot); err != nil { return err } + if err := p.writeField8(oprot); err != nil { + return err + } if err := oprot.WriteFieldStop(); err != nil { return fmt.Errorf("write field stop error: %s", err) } @@ -480,6 +519,21 @@ func (p *Message) writeField7(oprot thrift.TProtocol) (err error) { return err } +func (p *Message) writeField8(oprot thrift.TProtocol) (err error) { + if p.IsSetTag() { + if err := oprot.WriteFieldBegin("tag", thrift.STRING, 8); err != nil { + return fmt.Errorf("%T write field begin error 8:tag: %s", p, err) + } + if err := oprot.WriteString(string(*p.Tag)); err != nil { + return fmt.Errorf("%T.tag (8) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 8:tag: %s", p, err) + } + } + return err +} + func (p *Message) String() string { if p == nil { return "" @@ -492,6 +546,7 @@ type MessageIndex struct { MessageOffset int64 `thrift:"messageOffset,2,required" json:"messageOffset"` HdfsLogFileOffset int64 `thrift:"hdfsLogFileOffset,3,required" json:"hdfsLogFileOffset"` MessageNumber int32 `thrift:"messageNumber,4,required" json:"messageNumber"` + AppendTimeStamp int64 `thrift:"appendTimeStamp,5,required" json:"appendTimeStamp"` } func NewMessageIndex() *MessageIndex { @@ -518,6 +573,10 @@ func (p *MessageIndex) GetHdfsLogFileOffset() int64 { func (p *MessageIndex) GetMessageNumber() int32 { return p.MessageNumber } + +func (p *MessageIndex) GetAppendTimeStamp() int64 { + return p.AppendTimeStamp +} func (p *MessageIndex) IsSetTopicAndPartition() bool { return p.TopicAndPartition != nil } @@ -551,6 +610,10 @@ func (p *MessageIndex) Read(iprot thrift.TProtocol) error { if err := p.ReadField4(iprot); err != nil { return err } + case 5: + if err := p.ReadField5(iprot); err != nil { + return err + } default: if err := iprot.Skip(fieldTypeId); err != nil { return err @@ -601,6 +664,15 @@ func (p *MessageIndex) ReadField4(iprot thrift.TProtocol) error { return nil } +func (p *MessageIndex) ReadField5(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return fmt.Errorf("error reading field 5: %s", err) + } else { + p.AppendTimeStamp = v + } + return nil +} + func (p *MessageIndex) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("MessageIndex"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) @@ -617,6 +689,9 @@ func (p *MessageIndex) Write(oprot thrift.TProtocol) error { if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField5(oprot); err != nil { + return err + } if err := oprot.WriteFieldStop(); err != nil { return fmt.Errorf("write field stop error: %s", err) } @@ -678,6 +753,19 @@ func (p *MessageIndex) writeField4(oprot thrift.TProtocol) (err error) { return err } +func (p *MessageIndex) writeField5(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("appendTimeStamp", thrift.I64, 5); err != nil { + return fmt.Errorf("%T write field begin error 5:appendTimeStamp: %s", p, err) + } + if err := oprot.WriteI64(int64(p.AppendTimeStamp)); err != nil { + return fmt.Errorf("%T.appendTimeStamp (5) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 5:appendTimeStamp: %s", p, err) + } + return err +} + func (p *MessageIndex) String() string { if p == nil { return "" @@ -1050,6 +1138,158 @@ func (p *MessageAndOffset) String() string { return fmt.Sprintf("MessageAndOffset(%+v)", *p) } +type FetchMessageResult_ struct { + MessageList []*MessageAndOffset `thrift:"messageList,1,required" json:"messageList"` + NextReadOffset *int64 `thrift:"nextReadOffset,2" json:"nextReadOffset"` +} + +func NewFetchMessageResult_() *FetchMessageResult_ { + return &FetchMessageResult_{} +} + +func (p *FetchMessageResult_) GetMessageList() []*MessageAndOffset { + return p.MessageList +} + +var FetchMessageResult__NextReadOffset_DEFAULT int64 + +func (p *FetchMessageResult_) GetNextReadOffset() int64 { + if !p.IsSetNextReadOffset() { + return FetchMessageResult__NextReadOffset_DEFAULT + } + return *p.NextReadOffset +} +func (p *FetchMessageResult_) IsSetNextReadOffset() bool { + return p.NextReadOffset != nil +} + +func (p *FetchMessageResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return fmt.Errorf("%T read error: %s", p, err) + } + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + case 2: + if err := p.ReadField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return fmt.Errorf("%T read struct end error: %s", p, err) + } + return nil +} + +func (p *FetchMessageResult_) ReadField1(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return fmt.Errorf("error reading list begin: %s", err) + } + tSlice := make([]*MessageAndOffset, 0, size) + p.MessageList = tSlice + for i := 0; i < size; i++ { + _elem0 := &MessageAndOffset{} + if err := _elem0.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _elem0, err) + } + p.MessageList = append(p.MessageList, _elem0) + } + if err := iprot.ReadListEnd(); err != nil { + return fmt.Errorf("error reading list end: %s", err) + } + return nil +} + +func (p *FetchMessageResult_) ReadField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return fmt.Errorf("error reading field 2: %s", err) + } else { + p.NextReadOffset = &v + } + return nil +} + +func (p *FetchMessageResult_) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("FetchMessageResult"); err != nil { + return fmt.Errorf("%T write struct begin error: %s", p, err) + } + 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 fmt.Errorf("write field stop error: %s", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return fmt.Errorf("write struct stop error: %s", err) + } + return nil +} + +func (p *FetchMessageResult_) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("messageList", thrift.LIST, 1); err != nil { + return fmt.Errorf("%T write field begin error 1:messageList: %s", p, err) + } + if err := oprot.WriteListBegin(thrift.STRUCT, len(p.MessageList)); err != nil { + return fmt.Errorf("error writing list begin: %s", err) + } + for _, v := range p.MessageList { + if err := v.Write(oprot); err != nil { + return fmt.Errorf("%T error writing struct: %s", v, err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return fmt.Errorf("error writing list end: %s", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 1:messageList: %s", p, err) + } + return err +} + +func (p *FetchMessageResult_) writeField2(oprot thrift.TProtocol) (err error) { + if p.IsSetNextReadOffset() { + if err := oprot.WriteFieldBegin("nextReadOffset", thrift.I64, 2); err != nil { + return fmt.Errorf("%T write field begin error 2:nextReadOffset: %s", p, err) + } + if err := oprot.WriteI64(int64(*p.NextReadOffset)); err != nil { + return fmt.Errorf("%T.nextReadOffset (2) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 2:nextReadOffset: %s", p, err) + } + } + return err +} + +func (p *FetchMessageResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("FetchMessageResult_(%+v)", *p) +} + type MessageBlock struct { StartMessageOffset int64 `thrift:"startMessageOffset,1,required" json:"startMessageOffset"` MessageNumber int32 `thrift:"messageNumber,2,required" json:"messageNumber"` @@ -1060,6 +1300,8 @@ type MessageBlock struct { CreateTimestamp *int64 `thrift:"createTimestamp,7" json:"createTimestamp"` CreateTimestampList []int64 `thrift:"createTimestampList,8" json:"createTimestampList"` TransactionId *int64 `thrift:"transactionId,9" json:"transactionId"` + Tag *string `thrift:"tag,10" json:"tag"` + TagCode *int32 `thrift:"tagCode,11" json:"tagCode"` } func NewMessageBlock() *MessageBlock { @@ -1125,6 +1367,24 @@ func (p *MessageBlock) GetTransactionId() int64 { } return *p.TransactionId } + +var MessageBlock_Tag_DEFAULT string + +func (p *MessageBlock) GetTag() string { + if !p.IsSetTag() { + return MessageBlock_Tag_DEFAULT + } + return *p.Tag +} + +var MessageBlock_TagCode_DEFAULT int32 + +func (p *MessageBlock) GetTagCode() int32 { + if !p.IsSetTagCode() { + return MessageBlock_TagCode_DEFAULT + } + return *p.TagCode +} func (p *MessageBlock) IsSetMessageBlockSize() bool { return p.MessageBlockSize != nil } @@ -1145,6 +1405,14 @@ func (p *MessageBlock) IsSetTransactionId() bool { return p.TransactionId != nil } +func (p *MessageBlock) IsSetTag() bool { + return p.Tag != nil +} + +func (p *MessageBlock) IsSetTagCode() bool { + return p.TagCode != nil +} + func (p *MessageBlock) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return fmt.Errorf("%T read error: %s", p, err) @@ -1194,6 +1462,14 @@ func (p *MessageBlock) Read(iprot thrift.TProtocol) error { if err := p.ReadField9(iprot); err != nil { return err } + case 10: + if err := p.ReadField10(iprot); err != nil { + return err + } + case 11: + if err := p.ReadField11(iprot); err != nil { + return err + } default: if err := iprot.Skip(fieldTypeId); err != nil { return err @@ -1281,13 +1557,13 @@ func (p *MessageBlock) ReadField8(iprot thrift.TProtocol) error { tSlice := make([]int64, 0, size) p.CreateTimestampList = tSlice for i := 0; i < size; i++ { - var _elem0 int64 + var _elem1 int64 if v, err := iprot.ReadI64(); err != nil { return fmt.Errorf("error reading field 0: %s", err) } else { - _elem0 = v + _elem1 = v } - p.CreateTimestampList = append(p.CreateTimestampList, _elem0) + p.CreateTimestampList = append(p.CreateTimestampList, _elem1) } if err := iprot.ReadListEnd(); err != nil { return fmt.Errorf("error reading list end: %s", err) @@ -1304,6 +1580,24 @@ func (p *MessageBlock) ReadField9(iprot thrift.TProtocol) error { return nil } +func (p *MessageBlock) ReadField10(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return fmt.Errorf("error reading field 10: %s", err) + } else { + p.Tag = &v + } + return nil +} + +func (p *MessageBlock) ReadField11(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return fmt.Errorf("error reading field 11: %s", err) + } else { + p.TagCode = &v + } + return nil +} + func (p *MessageBlock) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("MessageBlock"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) @@ -1335,6 +1629,12 @@ func (p *MessageBlock) Write(oprot thrift.TProtocol) error { if err := p.writeField9(oprot); err != nil { return err } + if err := p.writeField10(oprot); err != nil { + return err + } + if err := p.writeField11(oprot); err != nil { + return err + } if err := oprot.WriteFieldStop(); err != nil { return fmt.Errorf("write field stop error: %s", err) } @@ -1479,6 +1779,36 @@ func (p *MessageBlock) writeField9(oprot thrift.TProtocol) (err error) { return err } +func (p *MessageBlock) writeField10(oprot thrift.TProtocol) (err error) { + if p.IsSetTag() { + if err := oprot.WriteFieldBegin("tag", thrift.STRING, 10); err != nil { + return fmt.Errorf("%T write field begin error 10:tag: %s", p, err) + } + if err := oprot.WriteString(string(*p.Tag)); err != nil { + return fmt.Errorf("%T.tag (10) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 10:tag: %s", p, err) + } + } + return err +} + +func (p *MessageBlock) writeField11(oprot thrift.TProtocol) (err error) { + if p.IsSetTagCode() { + if err := oprot.WriteFieldBegin("tagCode", thrift.I32, 11); err != nil { + return fmt.Errorf("%T write field begin error 11:tagCode: %s", p, err) + } + if err := oprot.WriteI32(int32(*p.TagCode)); err != nil { + return fmt.Errorf("%T.tagCode (11) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 11:tagCode: %s", p, err) + } + } + return err +} + func (p *MessageBlock) String() string { if p == nil { return "" @@ -1599,13 +1929,13 @@ func (p *PutMessageRequest) ReadField2(iprot thrift.TProtocol) error { tSlice := make([]*MessageBlock, 0, size) p.MessageBlocks = tSlice for i := 0; i < size; i++ { - _elem1 := &MessageBlock{ + _elem2 := &MessageBlock{ CompressionType: 0, } - if err := _elem1.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem1, err) + if err := _elem2.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _elem2, err) } - p.MessageBlocks = append(p.MessageBlocks, _elem1) + p.MessageBlocks = append(p.MessageBlocks, _elem2) } if err := iprot.ReadListEnd(); err != nil { return fmt.Errorf("error reading list end: %s", err) @@ -1886,12 +2216,13 @@ func (p *PutMessageResponse) String() string { type GetMessageRequest struct { TopicAndPartition *topic.TopicAndPartition `thrift:"topicAndPartition,1,required" json:"topicAndPartition"` // unused field # 2 - MessageOffset int64 `thrift:"messageOffset,3,required" json:"messageOffset"` - MaxGetMessageNumber int32 `thrift:"maxGetMessageNumber,4" json:"maxGetMessageNumber"` - MaxGetMessageBytes int32 `thrift:"maxGetMessageBytes,5" json:"maxGetMessageBytes"` - ShowUnHandledMessageNumber bool `thrift:"showUnHandledMessageNumber,6" json:"showUnHandledMessageNumber"` - SequenceId string `thrift:"sequenceId,7,required" json:"sequenceId"` - TimeoutTimestamp *int64 `thrift:"timeoutTimestamp,8" json:"timeoutTimestamp"` + MessageOffset int64 `thrift:"messageOffset,3,required" json:"messageOffset"` + MaxGetMessageNumber int32 `thrift:"maxGetMessageNumber,4" json:"maxGetMessageNumber"` + MaxGetMessageBytes int32 `thrift:"maxGetMessageBytes,5" json:"maxGetMessageBytes"` + ShowUnHandledMessageNumber bool `thrift:"showUnHandledMessageNumber,6" json:"showUnHandledMessageNumber"` + SequenceId string `thrift:"sequenceId,7,required" json:"sequenceId"` + TimeoutTimestamp *int64 `thrift:"timeoutTimestamp,8" json:"timeoutTimestamp"` + MessageTags map[string]bool `thrift:"messageTags,9" json:"messageTags"` } func NewGetMessageRequest() *GetMessageRequest { @@ -1947,6 +2278,12 @@ func (p *GetMessageRequest) GetTimeoutTimestamp() int64 { } return *p.TimeoutTimestamp } + +var GetMessageRequest_MessageTags_DEFAULT map[string]bool + +func (p *GetMessageRequest) GetMessageTags() map[string]bool { + return p.MessageTags +} func (p *GetMessageRequest) IsSetTopicAndPartition() bool { return p.TopicAndPartition != nil } @@ -1967,6 +2304,10 @@ func (p *GetMessageRequest) IsSetTimeoutTimestamp() bool { return p.TimeoutTimestamp != nil } +func (p *GetMessageRequest) IsSetMessageTags() bool { + return p.MessageTags != nil +} + func (p *GetMessageRequest) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return fmt.Errorf("%T read error: %s", p, err) @@ -2008,6 +2349,10 @@ func (p *GetMessageRequest) Read(iprot thrift.TProtocol) error { if err := p.ReadField8(iprot); err != nil { return err } + case 9: + if err := p.ReadField9(iprot); err != nil { + return err + } default: if err := iprot.Skip(fieldTypeId); err != nil { return err @@ -2085,6 +2430,28 @@ func (p *GetMessageRequest) ReadField8(iprot thrift.TProtocol) error { return nil } +func (p *GetMessageRequest) ReadField9(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return fmt.Errorf("error reading set begin: %s", err) + } + tSet := make(map[string]bool, size) + p.MessageTags = tSet + for i := 0; i < size; i++ { + var _elem3 string + if v, err := iprot.ReadString(); err != nil { + return fmt.Errorf("error reading field 0: %s", err) + } else { + _elem3 = v + } + p.MessageTags[_elem3] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return fmt.Errorf("error reading set end: %s", err) + } + return nil +} + func (p *GetMessageRequest) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("GetMessageRequest"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) @@ -2110,6 +2477,9 @@ func (p *GetMessageRequest) Write(oprot thrift.TProtocol) error { if err := p.writeField8(oprot); err != nil { return err } + if err := p.writeField9(oprot); err != nil { + return err + } if err := oprot.WriteFieldStop(); err != nil { return fmt.Errorf("write field stop error: %s", err) } @@ -2218,6 +2588,29 @@ func (p *GetMessageRequest) writeField8(oprot thrift.TProtocol) (err error) { return err } +func (p *GetMessageRequest) writeField9(oprot thrift.TProtocol) (err error) { + if p.IsSetMessageTags() { + if err := oprot.WriteFieldBegin("messageTags", thrift.SET, 9); err != nil { + return fmt.Errorf("%T write field begin error 9:messageTags: %s", p, err) + } + if err := oprot.WriteSetBegin(thrift.STRING, len(p.MessageTags)); err != nil { + return fmt.Errorf("error writing set begin: %s", err) + } + for v, _ := range p.MessageTags { + if err := oprot.WriteString(string(v)); err != nil { + return fmt.Errorf("%T. (0) field write error: %s", p, err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return fmt.Errorf("error writing set end: %s", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 9:messageTags: %s", p, err) + } + } + return err +} + func (p *GetMessageRequest) String() string { if p == nil { return "" @@ -2231,6 +2624,7 @@ type GetMessageResponse struct { UnHandledMessageNumber *int64 `thrift:"unHandledMessageNumber,3" json:"unHandledMessageNumber"` SequenceId string `thrift:"sequenceId,4,required" json:"sequenceId"` IsTransfer *bool `thrift:"isTransfer,5" json:"isTransfer"` + NextReadOffset *int64 `thrift:"nextReadOffset,6" json:"nextReadOffset"` } func NewGetMessageResponse() *GetMessageResponse { @@ -2266,6 +2660,15 @@ func (p *GetMessageResponse) GetIsTransfer() bool { } return *p.IsTransfer } + +var GetMessageResponse_NextReadOffset_DEFAULT int64 + +func (p *GetMessageResponse) GetNextReadOffset() int64 { + if !p.IsSetNextReadOffset() { + return GetMessageResponse_NextReadOffset_DEFAULT + } + return *p.NextReadOffset +} func (p *GetMessageResponse) IsSetUnHandledMessageNumber() bool { return p.UnHandledMessageNumber != nil } @@ -2274,6 +2677,10 @@ func (p *GetMessageResponse) IsSetIsTransfer() bool { return p.IsTransfer != nil } +func (p *GetMessageResponse) IsSetNextReadOffset() bool { + return p.NextReadOffset != nil +} + func (p *GetMessageResponse) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return fmt.Errorf("%T read error: %s", p, err) @@ -2307,6 +2714,10 @@ func (p *GetMessageResponse) Read(iprot thrift.TProtocol) error { if err := p.ReadField5(iprot); err != nil { return err } + case 6: + if err := p.ReadField6(iprot); err != nil { + return err + } default: if err := iprot.Skip(fieldTypeId); err != nil { return err @@ -2330,13 +2741,13 @@ func (p *GetMessageResponse) ReadField1(iprot thrift.TProtocol) error { tSlice := make([]*MessageBlock, 0, size) p.MessageBlocks = tSlice for i := 0; i < size; i++ { - _elem2 := &MessageBlock{ + _elem4 := &MessageBlock{ CompressionType: 0, } - if err := _elem2.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem2, err) + if err := _elem4.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _elem4, err) } - p.MessageBlocks = append(p.MessageBlocks, _elem2) + p.MessageBlocks = append(p.MessageBlocks, _elem4) } if err := iprot.ReadListEnd(); err != nil { return fmt.Errorf("error reading list end: %s", err) @@ -2380,6 +2791,15 @@ func (p *GetMessageResponse) ReadField5(iprot thrift.TProtocol) error { return nil } +func (p *GetMessageResponse) ReadField6(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return fmt.Errorf("error reading field 6: %s", err) + } else { + p.NextReadOffset = &v + } + return nil +} + func (p *GetMessageResponse) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("GetMessageResponse"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) @@ -2399,6 +2819,9 @@ func (p *GetMessageResponse) Write(oprot thrift.TProtocol) error { if err := p.writeField5(oprot); err != nil { return err } + if err := p.writeField6(oprot); err != nil { + return err + } if err := oprot.WriteFieldStop(); err != nil { return fmt.Errorf("write field stop error: %s", err) } @@ -2485,6 +2908,21 @@ func (p *GetMessageResponse) writeField5(oprot thrift.TProtocol) (err error) { return err } +func (p *GetMessageResponse) writeField6(oprot thrift.TProtocol) (err error) { + if p.IsSetNextReadOffset() { + if err := oprot.WriteFieldBegin("nextReadOffset", thrift.I64, 6); err != nil { + return fmt.Errorf("%T write field begin error 6:nextReadOffset: %s", p, err) + } + if err := oprot.WriteI64(int64(*p.NextReadOffset)); err != nil { + return fmt.Errorf("%T.nextReadOffset (6) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 6:nextReadOffset: %s", p, err) + } + } + return err +} + func (p *GetMessageResponse) String() string { if p == nil { return "" @@ -3799,19 +4237,19 @@ func (p *GetUnkownStateTransactionResponse) ReadField1(iprot thrift.TProtocol) e tMap := make(map[int64]*MessageBlock, size) p.UnknowStateTransactions = tMap for i := 0; i < size; i++ { - var _key3 int64 + var _key5 int64 if v, err := iprot.ReadI64(); err != nil { return fmt.Errorf("error reading field 0: %s", err) } else { - _key3 = v + _key5 = v } - _val4 := &MessageBlock{ + _val6 := &MessageBlock{ CompressionType: 0, } - if err := _val4.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _val4, err) + if err := _val6.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _val6, err) } - p.UnknowStateTransactions[_key3] = _val4 + p.UnknowStateTransactions[_key5] = _val6 } if err := iprot.ReadMapEnd(); err != nil { return fmt.Errorf("error reading map end: %s", err) @@ -4307,11 +4745,11 @@ func (p *GetTopicOffsetResponse) ReadField1(iprot thrift.TProtocol) error { tSlice := make([]*OffsetInfo, 0, size) p.OffsetInfoList = tSlice for i := 0; i < size; i++ { - _elem5 := &OffsetInfo{} - if err := _elem5.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem5, err) + _elem7 := &OffsetInfo{} + if err := _elem7.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _elem7, err) } - p.OffsetInfoList = append(p.OffsetInfoList, _elem5) + p.OffsetInfoList = append(p.OffsetInfoList, _elem7) } if err := iprot.ReadListEnd(); err != nil { return fmt.Errorf("error reading list end: %s", err) @@ -4606,11 +5044,11 @@ func (p *GetPartitionsOffsetRequest) ReadField1(iprot thrift.TProtocol) error { tSlice := make([]*topic.TopicAndPartition, 0, size) p.TopicAndPartitionList = tSlice for i := 0; i < size; i++ { - _elem6 := &topic.TopicAndPartition{} - if err := _elem6.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem6, err) + _elem8 := &topic.TopicAndPartition{} + if err := _elem8.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _elem8, err) } - p.TopicAndPartitionList = append(p.TopicAndPartitionList, _elem6) + p.TopicAndPartitionList = append(p.TopicAndPartitionList, _elem8) } if err := iprot.ReadListEnd(); err != nil { return fmt.Errorf("error reading list end: %s", err) @@ -4713,11 +5151,11 @@ func (p *GetPartitionsOffsetResponse) ReadField1(iprot thrift.TProtocol) error { tSlice := make([]*OffsetInfo, 0, size) p.OffsetInfoList = tSlice for i := 0; i < size; i++ { - _elem7 := &OffsetInfo{} - if err := _elem7.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem7, err) + _elem9 := &OffsetInfo{} + if err := _elem9.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _elem9, err) } - p.OffsetInfoList = append(p.OffsetInfoList, _elem7) + p.OffsetInfoList = append(p.OffsetInfoList, _elem9) } if err := iprot.ReadListEnd(); err != nil { return fmt.Errorf("error reading list end: %s", err) @@ -4916,17 +5354,17 @@ func (p *GetScheduleInfoResponse) ReadField1(iprot thrift.TProtocol) error { tMap := make(map[*topic.TopicAndPartition]string, size) p.ScheduleInfo = tMap for i := 0; i < size; i++ { - _key8 := &topic.TopicAndPartition{} - if err := _key8.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _key8, err) + _key10 := &topic.TopicAndPartition{} + if err := _key10.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _key10, err) } - var _val9 string + var _val11 string if v, err := iprot.ReadString(); err != nil { return fmt.Errorf("error reading field 0: %s", err) } else { - _val9 = v + _val11 = v } - p.ScheduleInfo[_key8] = _val9 + p.ScheduleInfo[_key10] = _val11 } if err := iprot.ReadMapEnd(); err != nil { return fmt.Errorf("error reading map end: %s", err) @@ -4982,15 +5420,15 @@ func (p *GetScheduleInfoResponse) String() string { } type LookupTopicsRequest struct { - TopicPattern string `thrift:"topicPattern,1,required" json:"topicPattern"` + TopicGroup string `thrift:"topicGroup,1,required" json:"topicGroup"` } func NewLookupTopicsRequest() *LookupTopicsRequest { return &LookupTopicsRequest{} } -func (p *LookupTopicsRequest) GetTopicPattern() string { - return p.TopicPattern +func (p *LookupTopicsRequest) GetTopicGroup() string { + return p.TopicGroup } func (p *LookupTopicsRequest) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { @@ -5028,7 +5466,7 @@ func (p *LookupTopicsRequest) ReadField1(iprot thrift.TProtocol) error { if v, err := iprot.ReadString(); err != nil { return fmt.Errorf("error reading field 1: %s", err) } else { - p.TopicPattern = v + p.TopicGroup = v } return nil } @@ -5050,14 +5488,14 @@ func (p *LookupTopicsRequest) Write(oprot thrift.TProtocol) error { } func (p *LookupTopicsRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("topicPattern", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:topicPattern: %s", p, err) + if err := oprot.WriteFieldBegin("topicGroup", thrift.STRING, 1); err != nil { + return fmt.Errorf("%T write field begin error 1:topicGroup: %s", p, err) } - if err := oprot.WriteString(string(p.TopicPattern)); err != nil { - return fmt.Errorf("%T.topicPattern (1) field write error: %s", p, err) + if err := oprot.WriteString(string(p.TopicGroup)); err != nil { + return fmt.Errorf("%T.topicGroup (1) field write error: %s", p, err) } if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:topicPattern: %s", p, err) + return fmt.Errorf("%T write field end error 1:topicGroup: %s", p, err) } return err } @@ -5120,19 +5558,19 @@ func (p *LookupTopicsResponse) ReadField1(iprot thrift.TProtocol) error { tMap := make(map[string]int32, size) p.Topics = tMap for i := 0; i < size; i++ { - var _key10 string + var _key12 string if v, err := iprot.ReadString(); err != nil { return fmt.Errorf("error reading field 0: %s", err) } else { - _key10 = v + _key12 = v } - var _val11 int32 + var _val13 int32 if v, err := iprot.ReadI32(); err != nil { return fmt.Errorf("error reading field 0: %s", err) } else { - _val11 = v + _val13 = v } - p.Topics[_key10] = _val11 + p.Topics[_key12] = _val13 } if err := iprot.ReadMapEnd(); err != nil { return fmt.Errorf("error reading map end: %s", err) diff --git a/thrift/topic/constants.go b/thrift/topic/constants.go index 034ab10..4426c4b 100644 --- a/thrift/topic/constants.go +++ b/thrift/topic/constants.go @@ -6,7 +6,6 @@ package topic import ( "bytes" "fmt" - "github.com/XiaoMi/talos-sdk-golang/thrift/authorization" "github.com/XiaoMi/talos-sdk-golang/thrift/common" "github.com/XiaoMi/talos-sdk-golang/thrift/quota" diff --git a/thrift/topic/topic_service-remote/topic_service-remote.go b/thrift/topic/topic_service-remote/topic_service-remote.go index 2cdd67d..bf912a6 100755 --- a/thrift/topic/topic_service-remote/topic_service-remote.go +++ b/thrift/topic/topic_service-remote/topic_service-remote.go @@ -6,6 +6,7 @@ package main import ( "flag" "fmt" + "github.com/XiaoMi/talos-sdk-golang/thrift/thrift" "math" "net" "net/url" @@ -13,8 +14,6 @@ import ( "strconv" "strings" "thrift/topic" - - "github.com/XiaoMi/talos-sdk-golang/thrift/thrift" ) func Usage() { @@ -144,19 +143,19 @@ func main() { fmt.Fprintln(os.Stderr, "CreateTopic requires 1 args") flag.Usage() } - arg62 := flag.Arg(1) - mbTrans63 := thrift.NewTMemoryBufferLen(len(arg62)) - defer mbTrans63.Close() - _, err64 := mbTrans63.WriteString(arg62) - if err64 != nil { + arg63 := flag.Arg(1) + mbTrans64 := thrift.NewTMemoryBufferLen(len(arg63)) + defer mbTrans64.Close() + _, err65 := mbTrans64.WriteString(arg63) + if err65 != nil { Usage() return } - factory65 := thrift.NewTSimpleJSONProtocolFactory() - jsProt66 := factory65.GetProtocol(mbTrans63) + factory66 := thrift.NewTSimpleJSONProtocolFactory() + jsProt67 := factory66.GetProtocol(mbTrans64) argvalue0 := topic.NewCreateTopicRequest() - err67 := argvalue0.Read(jsProt66) - if err67 != nil { + err68 := argvalue0.Read(jsProt67) + if err68 != nil { Usage() return } @@ -169,19 +168,19 @@ func main() { fmt.Fprintln(os.Stderr, "CreateReplicationTopic requires 1 args") flag.Usage() } - arg68 := flag.Arg(1) - mbTrans69 := thrift.NewTMemoryBufferLen(len(arg68)) - defer mbTrans69.Close() - _, err70 := mbTrans69.WriteString(arg68) - if err70 != nil { + arg69 := flag.Arg(1) + mbTrans70 := thrift.NewTMemoryBufferLen(len(arg69)) + defer mbTrans70.Close() + _, err71 := mbTrans70.WriteString(arg69) + if err71 != nil { Usage() return } - factory71 := thrift.NewTSimpleJSONProtocolFactory() - jsProt72 := factory71.GetProtocol(mbTrans69) + factory72 := thrift.NewTSimpleJSONProtocolFactory() + jsProt73 := factory72.GetProtocol(mbTrans70) argvalue0 := topic.NewCreateReplicationTopicRequest() - err73 := argvalue0.Read(jsProt72) - if err73 != nil { + err74 := argvalue0.Read(jsProt73) + if err74 != nil { Usage() return } @@ -194,19 +193,19 @@ func main() { fmt.Fprintln(os.Stderr, "CreateTopicGroup requires 1 args") flag.Usage() } - arg74 := flag.Arg(1) - mbTrans75 := thrift.NewTMemoryBufferLen(len(arg74)) - defer mbTrans75.Close() - _, err76 := mbTrans75.WriteString(arg74) - if err76 != nil { + arg75 := flag.Arg(1) + mbTrans76 := thrift.NewTMemoryBufferLen(len(arg75)) + defer mbTrans76.Close() + _, err77 := mbTrans76.WriteString(arg75) + if err77 != nil { Usage() return } - factory77 := thrift.NewTSimpleJSONProtocolFactory() - jsProt78 := factory77.GetProtocol(mbTrans75) + factory78 := thrift.NewTSimpleJSONProtocolFactory() + jsProt79 := factory78.GetProtocol(mbTrans76) argvalue0 := topic.NewCreateTopicGroupRequest() - err79 := argvalue0.Read(jsProt78) - if err79 != nil { + err80 := argvalue0.Read(jsProt79) + if err80 != nil { Usage() return } @@ -219,19 +218,19 @@ func main() { fmt.Fprintln(os.Stderr, "DescribeTopicGroup requires 1 args") flag.Usage() } - arg80 := flag.Arg(1) - mbTrans81 := thrift.NewTMemoryBufferLen(len(arg80)) - defer mbTrans81.Close() - _, err82 := mbTrans81.WriteString(arg80) - if err82 != nil { + arg81 := flag.Arg(1) + mbTrans82 := thrift.NewTMemoryBufferLen(len(arg81)) + defer mbTrans82.Close() + _, err83 := mbTrans82.WriteString(arg81) + if err83 != nil { Usage() return } - factory83 := thrift.NewTSimpleJSONProtocolFactory() - jsProt84 := factory83.GetProtocol(mbTrans81) + factory84 := thrift.NewTSimpleJSONProtocolFactory() + jsProt85 := factory84.GetProtocol(mbTrans82) argvalue0 := topic.NewDescribeTopicGroupRequest() - err85 := argvalue0.Read(jsProt84) - if err85 != nil { + err86 := argvalue0.Read(jsProt85) + if err86 != nil { Usage() return } @@ -244,19 +243,19 @@ func main() { fmt.Fprintln(os.Stderr, "DeleteTopicGroup requires 1 args") flag.Usage() } - arg86 := flag.Arg(1) - mbTrans87 := thrift.NewTMemoryBufferLen(len(arg86)) - defer mbTrans87.Close() - _, err88 := mbTrans87.WriteString(arg86) - if err88 != nil { + arg87 := flag.Arg(1) + mbTrans88 := thrift.NewTMemoryBufferLen(len(arg87)) + defer mbTrans88.Close() + _, err89 := mbTrans88.WriteString(arg87) + if err89 != nil { Usage() return } - factory89 := thrift.NewTSimpleJSONProtocolFactory() - jsProt90 := factory89.GetProtocol(mbTrans87) + factory90 := thrift.NewTSimpleJSONProtocolFactory() + jsProt91 := factory90.GetProtocol(mbTrans88) argvalue0 := topic.NewDeleteTopicGroupRequest() - err91 := argvalue0.Read(jsProt90) - if err91 != nil { + err92 := argvalue0.Read(jsProt91) + if err92 != nil { Usage() return } @@ -269,19 +268,19 @@ func main() { fmt.Fprintln(os.Stderr, "ListTopicGroup requires 1 args") flag.Usage() } - arg92 := flag.Arg(1) - mbTrans93 := thrift.NewTMemoryBufferLen(len(arg92)) - defer mbTrans93.Close() - _, err94 := mbTrans93.WriteString(arg92) - if err94 != nil { + arg93 := flag.Arg(1) + mbTrans94 := thrift.NewTMemoryBufferLen(len(arg93)) + defer mbTrans94.Close() + _, err95 := mbTrans94.WriteString(arg93) + if err95 != nil { Usage() return } - factory95 := thrift.NewTSimpleJSONProtocolFactory() - jsProt96 := factory95.GetProtocol(mbTrans93) + factory96 := thrift.NewTSimpleJSONProtocolFactory() + jsProt97 := factory96.GetProtocol(mbTrans94) argvalue0 := topic.NewListTopicGroupRequest() - err97 := argvalue0.Read(jsProt96) - if err97 != nil { + err98 := argvalue0.Read(jsProt97) + if err98 != nil { Usage() return } @@ -294,19 +293,19 @@ func main() { fmt.Fprintln(os.Stderr, "DeleteTopic requires 1 args") flag.Usage() } - arg98 := flag.Arg(1) - mbTrans99 := thrift.NewTMemoryBufferLen(len(arg98)) - defer mbTrans99.Close() - _, err100 := mbTrans99.WriteString(arg98) - if err100 != nil { + arg99 := flag.Arg(1) + mbTrans100 := thrift.NewTMemoryBufferLen(len(arg99)) + defer mbTrans100.Close() + _, err101 := mbTrans100.WriteString(arg99) + if err101 != nil { Usage() return } - factory101 := thrift.NewTSimpleJSONProtocolFactory() - jsProt102 := factory101.GetProtocol(mbTrans99) + factory102 := thrift.NewTSimpleJSONProtocolFactory() + jsProt103 := factory102.GetProtocol(mbTrans100) argvalue0 := topic.NewDeleteTopicRequest() - err103 := argvalue0.Read(jsProt102) - if err103 != nil { + err104 := argvalue0.Read(jsProt103) + if err104 != nil { Usage() return } @@ -319,19 +318,19 @@ func main() { fmt.Fprintln(os.Stderr, "ChangeTopicAttribute requires 1 args") flag.Usage() } - arg104 := flag.Arg(1) - mbTrans105 := thrift.NewTMemoryBufferLen(len(arg104)) - defer mbTrans105.Close() - _, err106 := mbTrans105.WriteString(arg104) - if err106 != nil { + arg105 := flag.Arg(1) + mbTrans106 := thrift.NewTMemoryBufferLen(len(arg105)) + defer mbTrans106.Close() + _, err107 := mbTrans106.WriteString(arg105) + if err107 != nil { Usage() return } - factory107 := thrift.NewTSimpleJSONProtocolFactory() - jsProt108 := factory107.GetProtocol(mbTrans105) + factory108 := thrift.NewTSimpleJSONProtocolFactory() + jsProt109 := factory108.GetProtocol(mbTrans106) argvalue0 := topic.NewChangeTopicAttributeRequest() - err109 := argvalue0.Read(jsProt108) - if err109 != nil { + err110 := argvalue0.Read(jsProt109) + if err110 != nil { Usage() return } @@ -344,19 +343,19 @@ func main() { fmt.Fprintln(os.Stderr, "DescribeTopic requires 1 args") flag.Usage() } - arg110 := flag.Arg(1) - mbTrans111 := thrift.NewTMemoryBufferLen(len(arg110)) - defer mbTrans111.Close() - _, err112 := mbTrans111.WriteString(arg110) - if err112 != nil { + arg111 := flag.Arg(1) + mbTrans112 := thrift.NewTMemoryBufferLen(len(arg111)) + defer mbTrans112.Close() + _, err113 := mbTrans112.WriteString(arg111) + if err113 != nil { Usage() return } - factory113 := thrift.NewTSimpleJSONProtocolFactory() - jsProt114 := factory113.GetProtocol(mbTrans111) + factory114 := thrift.NewTSimpleJSONProtocolFactory() + jsProt115 := factory114.GetProtocol(mbTrans112) argvalue0 := topic.NewDescribeTopicRequest() - err115 := argvalue0.Read(jsProt114) - if err115 != nil { + err116 := argvalue0.Read(jsProt115) + if err116 != nil { Usage() return } @@ -369,19 +368,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetDescribeInfo requires 1 args") flag.Usage() } - arg116 := flag.Arg(1) - mbTrans117 := thrift.NewTMemoryBufferLen(len(arg116)) - defer mbTrans117.Close() - _, err118 := mbTrans117.WriteString(arg116) - if err118 != nil { + arg117 := flag.Arg(1) + mbTrans118 := thrift.NewTMemoryBufferLen(len(arg117)) + defer mbTrans118.Close() + _, err119 := mbTrans118.WriteString(arg117) + if err119 != nil { Usage() return } - factory119 := thrift.NewTSimpleJSONProtocolFactory() - jsProt120 := factory119.GetProtocol(mbTrans117) + factory120 := thrift.NewTSimpleJSONProtocolFactory() + jsProt121 := factory120.GetProtocol(mbTrans118) argvalue0 := topic.NewGetDescribeInfoRequest() - err121 := argvalue0.Read(jsProt120) - if err121 != nil { + err122 := argvalue0.Read(jsProt121) + if err122 != nil { Usage() return } @@ -394,19 +393,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTopicAttribute requires 1 args") flag.Usage() } - arg122 := flag.Arg(1) - mbTrans123 := thrift.NewTMemoryBufferLen(len(arg122)) - defer mbTrans123.Close() - _, err124 := mbTrans123.WriteString(arg122) - if err124 != nil { + arg123 := flag.Arg(1) + mbTrans124 := thrift.NewTMemoryBufferLen(len(arg123)) + defer mbTrans124.Close() + _, err125 := mbTrans124.WriteString(arg123) + if err125 != nil { Usage() return } - factory125 := thrift.NewTSimpleJSONProtocolFactory() - jsProt126 := factory125.GetProtocol(mbTrans123) + factory126 := thrift.NewTSimpleJSONProtocolFactory() + jsProt127 := factory126.GetProtocol(mbTrans124) argvalue0 := topic.NewGetTopicAttributeRequest() - err127 := argvalue0.Read(jsProt126) - if err127 != nil { + err128 := argvalue0.Read(jsProt127) + if err128 != nil { Usage() return } @@ -443,19 +442,19 @@ func main() { fmt.Fprintln(os.Stderr, "SetTopicQuota requires 1 args") flag.Usage() } - arg128 := flag.Arg(1) - mbTrans129 := thrift.NewTMemoryBufferLen(len(arg128)) - defer mbTrans129.Close() - _, err130 := mbTrans129.WriteString(arg128) - if err130 != nil { + arg129 := flag.Arg(1) + mbTrans130 := thrift.NewTMemoryBufferLen(len(arg129)) + defer mbTrans130.Close() + _, err131 := mbTrans130.WriteString(arg129) + if err131 != nil { Usage() return } - factory131 := thrift.NewTSimpleJSONProtocolFactory() - jsProt132 := factory131.GetProtocol(mbTrans129) + factory132 := thrift.NewTSimpleJSONProtocolFactory() + jsProt133 := factory132.GetProtocol(mbTrans130) argvalue0 := topic.NewSetTopicQuotaRequest() - err133 := argvalue0.Read(jsProt132) - if err133 != nil { + err134 := argvalue0.Read(jsProt133) + if err134 != nil { Usage() return } @@ -468,19 +467,19 @@ func main() { fmt.Fprintln(os.Stderr, "QueryTopicQuota requires 1 args") flag.Usage() } - arg134 := flag.Arg(1) - mbTrans135 := thrift.NewTMemoryBufferLen(len(arg134)) - defer mbTrans135.Close() - _, err136 := mbTrans135.WriteString(arg134) - if err136 != nil { + arg135 := flag.Arg(1) + mbTrans136 := thrift.NewTMemoryBufferLen(len(arg135)) + defer mbTrans136.Close() + _, err137 := mbTrans136.WriteString(arg135) + if err137 != nil { Usage() return } - factory137 := thrift.NewTSimpleJSONProtocolFactory() - jsProt138 := factory137.GetProtocol(mbTrans135) + factory138 := thrift.NewTSimpleJSONProtocolFactory() + jsProt139 := factory138.GetProtocol(mbTrans136) argvalue0 := topic.NewQueryTopicQuotaRequest() - err139 := argvalue0.Read(jsProt138) - if err139 != nil { + err140 := argvalue0.Read(jsProt139) + if err140 != nil { Usage() return } @@ -493,19 +492,19 @@ func main() { fmt.Fprintln(os.Stderr, "DeleteTopicQuota requires 1 args") flag.Usage() } - arg140 := flag.Arg(1) - mbTrans141 := thrift.NewTMemoryBufferLen(len(arg140)) - defer mbTrans141.Close() - _, err142 := mbTrans141.WriteString(arg140) - if err142 != nil { + arg141 := flag.Arg(1) + mbTrans142 := thrift.NewTMemoryBufferLen(len(arg141)) + defer mbTrans142.Close() + _, err143 := mbTrans142.WriteString(arg141) + if err143 != nil { Usage() return } - factory143 := thrift.NewTSimpleJSONProtocolFactory() - jsProt144 := factory143.GetProtocol(mbTrans141) + factory144 := thrift.NewTSimpleJSONProtocolFactory() + jsProt145 := factory144.GetProtocol(mbTrans142) argvalue0 := topic.NewDeleteTopicQuotaRequest() - err145 := argvalue0.Read(jsProt144) - if err145 != nil { + err146 := argvalue0.Read(jsProt145) + if err146 != nil { Usage() return } @@ -518,19 +517,19 @@ func main() { fmt.Fprintln(os.Stderr, "SetPermission requires 1 args") flag.Usage() } - arg146 := flag.Arg(1) - mbTrans147 := thrift.NewTMemoryBufferLen(len(arg146)) - defer mbTrans147.Close() - _, err148 := mbTrans147.WriteString(arg146) - if err148 != nil { + arg147 := flag.Arg(1) + mbTrans148 := thrift.NewTMemoryBufferLen(len(arg147)) + defer mbTrans148.Close() + _, err149 := mbTrans148.WriteString(arg147) + if err149 != nil { Usage() return } - factory149 := thrift.NewTSimpleJSONProtocolFactory() - jsProt150 := factory149.GetProtocol(mbTrans147) + factory150 := thrift.NewTSimpleJSONProtocolFactory() + jsProt151 := factory150.GetProtocol(mbTrans148) argvalue0 := topic.NewSetPermissionRequest() - err151 := argvalue0.Read(jsProt150) - if err151 != nil { + err152 := argvalue0.Read(jsProt151) + if err152 != nil { Usage() return } @@ -543,19 +542,19 @@ func main() { fmt.Fprintln(os.Stderr, "RevokePermission requires 1 args") flag.Usage() } - arg152 := flag.Arg(1) - mbTrans153 := thrift.NewTMemoryBufferLen(len(arg152)) - defer mbTrans153.Close() - _, err154 := mbTrans153.WriteString(arg152) - if err154 != nil { + arg153 := flag.Arg(1) + mbTrans154 := thrift.NewTMemoryBufferLen(len(arg153)) + defer mbTrans154.Close() + _, err155 := mbTrans154.WriteString(arg153) + if err155 != nil { Usage() return } - factory155 := thrift.NewTSimpleJSONProtocolFactory() - jsProt156 := factory155.GetProtocol(mbTrans153) + factory156 := thrift.NewTSimpleJSONProtocolFactory() + jsProt157 := factory156.GetProtocol(mbTrans154) argvalue0 := topic.NewRevokePermissionRequest() - err157 := argvalue0.Read(jsProt156) - if err157 != nil { + err158 := argvalue0.Read(jsProt157) + if err158 != nil { Usage() return } @@ -568,19 +567,19 @@ func main() { fmt.Fprintln(os.Stderr, "ListPermission requires 1 args") flag.Usage() } - arg158 := flag.Arg(1) - mbTrans159 := thrift.NewTMemoryBufferLen(len(arg158)) - defer mbTrans159.Close() - _, err160 := mbTrans159.WriteString(arg158) - if err160 != nil { + arg159 := flag.Arg(1) + mbTrans160 := thrift.NewTMemoryBufferLen(len(arg159)) + defer mbTrans160.Close() + _, err161 := mbTrans160.WriteString(arg159) + if err161 != nil { Usage() return } - factory161 := thrift.NewTSimpleJSONProtocolFactory() - jsProt162 := factory161.GetProtocol(mbTrans159) + factory162 := thrift.NewTSimpleJSONProtocolFactory() + jsProt163 := factory162.GetProtocol(mbTrans160) argvalue0 := topic.NewListPermissionRequest() - err163 := argvalue0.Read(jsProt162) - if err163 != nil { + err164 := argvalue0.Read(jsProt163) + if err164 != nil { Usage() return } @@ -593,19 +592,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetPermission requires 1 args") flag.Usage() } - arg164 := flag.Arg(1) - mbTrans165 := thrift.NewTMemoryBufferLen(len(arg164)) - defer mbTrans165.Close() - _, err166 := mbTrans165.WriteString(arg164) - if err166 != nil { + arg165 := flag.Arg(1) + mbTrans166 := thrift.NewTMemoryBufferLen(len(arg165)) + defer mbTrans166.Close() + _, err167 := mbTrans166.WriteString(arg165) + if err167 != nil { Usage() return } - factory167 := thrift.NewTSimpleJSONProtocolFactory() - jsProt168 := factory167.GetProtocol(mbTrans165) + factory168 := thrift.NewTSimpleJSONProtocolFactory() + jsProt169 := factory168.GetProtocol(mbTrans166) argvalue0 := topic.NewGetPermissionRequest() - err169 := argvalue0.Read(jsProt168) - if err169 != nil { + err170 := argvalue0.Read(jsProt169) + if err170 != nil { Usage() return } @@ -618,19 +617,19 @@ func main() { fmt.Fprintln(os.Stderr, "AddSubResourceName requires 1 args") flag.Usage() } - arg170 := flag.Arg(1) - mbTrans171 := thrift.NewTMemoryBufferLen(len(arg170)) - defer mbTrans171.Close() - _, err172 := mbTrans171.WriteString(arg170) - if err172 != nil { + arg171 := flag.Arg(1) + mbTrans172 := thrift.NewTMemoryBufferLen(len(arg171)) + defer mbTrans172.Close() + _, err173 := mbTrans172.WriteString(arg171) + if err173 != nil { Usage() return } - factory173 := thrift.NewTSimpleJSONProtocolFactory() - jsProt174 := factory173.GetProtocol(mbTrans171) + factory174 := thrift.NewTSimpleJSONProtocolFactory() + jsProt175 := factory174.GetProtocol(mbTrans172) argvalue0 := topic.NewAddSubResourceNameRequest() - err175 := argvalue0.Read(jsProt174) - if err175 != nil { + err176 := argvalue0.Read(jsProt175) + if err176 != nil { Usage() return } @@ -651,19 +650,19 @@ func main() { fmt.Fprintln(os.Stderr, "ValidClientVersion requires 1 args") flag.Usage() } - arg176 := flag.Arg(1) - mbTrans177 := thrift.NewTMemoryBufferLen(len(arg176)) - defer mbTrans177.Close() - _, err178 := mbTrans177.WriteString(arg176) - if err178 != nil { + arg177 := flag.Arg(1) + mbTrans178 := thrift.NewTMemoryBufferLen(len(arg177)) + defer mbTrans178.Close() + _, err179 := mbTrans178.WriteString(arg177) + if err179 != nil { Usage() return } - factory179 := thrift.NewTSimpleJSONProtocolFactory() - jsProt180 := factory179.GetProtocol(mbTrans177) + factory180 := thrift.NewTSimpleJSONProtocolFactory() + jsProt181 := factory180.GetProtocol(mbTrans178) argvalue0 := topic.NewVersion() - err181 := argvalue0.Read(jsProt180) - if err181 != nil { + err182 := argvalue0.Read(jsProt181) + if err182 != nil { Usage() return } diff --git a/thrift/topic/topicservice.go b/thrift/topic/topicservice.go index dac834f..b6c0b12 100644 --- a/thrift/topic/topicservice.go +++ b/thrift/topic/topicservice.go @@ -211,16 +211,16 @@ func (p *TopicServiceClient) recvCreateTopic() (value *CreateTopicResponse, err return } if mTypeId == thrift.EXCEPTION { - error17 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error18 error - error18, err = error17.Read(iprot) + error18 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error19 error + error19, err = error18.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error18 + err = error19 return } if p.SeqId != seqId { @@ -287,16 +287,16 @@ func (p *TopicServiceClient) recvCreateReplicationTopic() (value *CreateTopicRes return } if mTypeId == thrift.EXCEPTION { - error19 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error20 error - error20, err = error19.Read(iprot) + error20 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error21 error + error21, err = error20.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error20 + err = error21 return } if p.SeqId != seqId { @@ -363,16 +363,16 @@ func (p *TopicServiceClient) recvCreateTopicGroup() (value *CreateTopicGroupResp return } if mTypeId == thrift.EXCEPTION { - error21 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error22 error - error22, err = error21.Read(iprot) + error22 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error23 error + error23, err = error22.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error22 + err = error23 return } if p.SeqId != seqId { @@ -439,16 +439,16 @@ func (p *TopicServiceClient) recvDescribeTopicGroup() (value *DescribeTopicGroup return } if mTypeId == thrift.EXCEPTION { - error23 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error24 error - error24, err = error23.Read(iprot) + error24 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error25 error + error25, err = error24.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error24 + err = error25 return } if p.SeqId != seqId { @@ -515,16 +515,16 @@ func (p *TopicServiceClient) recvDeleteTopicGroup() (err error) { return } if mTypeId == thrift.EXCEPTION { - error25 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error26 error - error26, err = error25.Read(iprot) + error26 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error27 error + error27, err = error26.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error26 + err = error27 return } if p.SeqId != seqId { @@ -590,16 +590,16 @@ func (p *TopicServiceClient) recvListTopicGroup() (value *ListTopicGroupResponse return } if mTypeId == thrift.EXCEPTION { - error27 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error28 error - error28, err = error27.Read(iprot) + error28 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error29 error + error29, err = error28.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error28 + err = error29 return } if p.SeqId != seqId { @@ -666,16 +666,16 @@ func (p *TopicServiceClient) recvDeleteTopic() (err error) { return } if mTypeId == thrift.EXCEPTION { - error29 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error30 error - error30, err = error29.Read(iprot) + error30 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error31 error + error31, err = error30.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error30 + err = error31 return } if p.SeqId != seqId { @@ -741,16 +741,16 @@ func (p *TopicServiceClient) recvChangeTopicAttribute() (err error) { return } if mTypeId == thrift.EXCEPTION { - error31 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error32 error - error32, err = error31.Read(iprot) + error32 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error33 error + error33, err = error32.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error32 + err = error33 return } if p.SeqId != seqId { @@ -816,16 +816,16 @@ func (p *TopicServiceClient) recvDescribeTopic() (value *DescribeTopicResponse, return } if mTypeId == thrift.EXCEPTION { - error33 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error34 error - error34, err = error33.Read(iprot) + error34 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error35 error + error35, err = error34.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error34 + err = error35 return } if p.SeqId != seqId { @@ -892,16 +892,16 @@ func (p *TopicServiceClient) recvGetDescribeInfo() (value *GetDescribeInfoRespon return } if mTypeId == thrift.EXCEPTION { - error35 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error36 error - error36, err = error35.Read(iprot) + error36 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error37 error + error37, err = error36.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error36 + err = error37 return } if p.SeqId != seqId { @@ -968,16 +968,16 @@ func (p *TopicServiceClient) recvGetTopicAttribute() (value *GetTopicAttributeRe return } if mTypeId == thrift.EXCEPTION { - error37 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error38 error - error38, err = error37.Read(iprot) + error38 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error39 error + error39, err = error38.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error38 + err = error39 return } if p.SeqId != seqId { @@ -1040,16 +1040,16 @@ func (p *TopicServiceClient) recvListTopicsInfo() (value *ListTopicsInfoResponse return } if mTypeId == thrift.EXCEPTION { - error39 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error40 error - error40, err = error39.Read(iprot) + error40 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error41 error + error41, err = error40.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error40 + err = error41 return } if p.SeqId != seqId { @@ -1113,16 +1113,16 @@ func (p *TopicServiceClient) recvListTopics() (value *ListTopicsResponse, err er return } if mTypeId == thrift.EXCEPTION { - error41 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error42 error - error42, err = error41.Read(iprot) + error42 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error43 error + error43, err = error42.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error42 + err = error43 return } if p.SeqId != seqId { @@ -1182,16 +1182,16 @@ func (p *TopicServiceClient) recvGetBindTopics() (value *ListTopicsResponse, err return } if mTypeId == thrift.EXCEPTION { - error43 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error44 error - error44, err = error43.Read(iprot) + error44 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error45 error + error45, err = error44.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error44 + err = error45 return } if p.SeqId != seqId { @@ -1258,16 +1258,16 @@ func (p *TopicServiceClient) recvSetTopicQuota() (err error) { return } if mTypeId == thrift.EXCEPTION { - error45 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error46 error - error46, err = error45.Read(iprot) + error46 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error47 error + error47, err = error46.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error46 + err = error47 return } if p.SeqId != seqId { @@ -1333,16 +1333,16 @@ func (p *TopicServiceClient) recvQueryTopicQuota() (value *QueryTopicQuotaRespon return } if mTypeId == thrift.EXCEPTION { - error47 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error48 error - error48, err = error47.Read(iprot) + error48 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error49 error + error49, err = error48.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error48 + err = error49 return } if p.SeqId != seqId { @@ -1409,16 +1409,16 @@ func (p *TopicServiceClient) recvDeleteTopicQuota() (err error) { return } if mTypeId == thrift.EXCEPTION { - error49 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error50 error - error50, err = error49.Read(iprot) + error50 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error51 error + error51, err = error50.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error50 + err = error51 return } if p.SeqId != seqId { @@ -1486,16 +1486,16 @@ func (p *TopicServiceClient) recvSetPermission() (err error) { return } if mTypeId == thrift.EXCEPTION { - error51 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error52 error - error52, err = error51.Read(iprot) + error52 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error53 error + error53, err = error52.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error52 + err = error53 return } if p.SeqId != seqId { @@ -1563,16 +1563,16 @@ func (p *TopicServiceClient) recvRevokePermission() (err error) { return } if mTypeId == thrift.EXCEPTION { - error53 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error54 error - error54, err = error53.Read(iprot) + error54 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error55 error + error55, err = error54.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error54 + err = error55 return } if p.SeqId != seqId { @@ -1638,16 +1638,16 @@ func (p *TopicServiceClient) recvListPermission() (value *ListPermissionResponse return } if mTypeId == thrift.EXCEPTION { - error55 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error56 error - error56, err = error55.Read(iprot) + error56 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error57 error + error57, err = error56.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error56 + err = error57 return } if p.SeqId != seqId { @@ -1714,16 +1714,16 @@ func (p *TopicServiceClient) recvGetPermission() (value *GetPermissionResponse, return } if mTypeId == thrift.EXCEPTION { - error57 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error58 error - error58, err = error57.Read(iprot) + error58 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error59 error + error59, err = error58.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error58 + err = error59 return } if p.SeqId != seqId { @@ -1790,16 +1790,16 @@ func (p *TopicServiceClient) recvAddSubResourceName() (err error) { return } if mTypeId == thrift.EXCEPTION { - error59 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error60 error - error60, err = error59.Read(iprot) + error60 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error61 error + error61, err = error60.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } - err = error60 + err = error61 return } if p.SeqId != seqId { @@ -1825,30 +1825,30 @@ type TopicServiceProcessor struct { } func NewTopicServiceProcessor(handler TopicService) *TopicServiceProcessor { - self61 := &TopicServiceProcessor{common.NewTalosBaseServiceProcessor(handler)} - self61.AddToProcessorMap("createTopic", &topicServiceProcessorCreateTopic{handler: handler}) - self61.AddToProcessorMap("createReplicationTopic", &topicServiceProcessorCreateReplicationTopic{handler: handler}) - self61.AddToProcessorMap("createTopicGroup", &topicServiceProcessorCreateTopicGroup{handler: handler}) - self61.AddToProcessorMap("describeTopicGroup", &topicServiceProcessorDescribeTopicGroup{handler: handler}) - self61.AddToProcessorMap("deleteTopicGroup", &topicServiceProcessorDeleteTopicGroup{handler: handler}) - self61.AddToProcessorMap("listTopicGroup", &topicServiceProcessorListTopicGroup{handler: handler}) - self61.AddToProcessorMap("deleteTopic", &topicServiceProcessorDeleteTopic{handler: handler}) - self61.AddToProcessorMap("changeTopicAttribute", &topicServiceProcessorChangeTopicAttribute{handler: handler}) - self61.AddToProcessorMap("describeTopic", &topicServiceProcessorDescribeTopic{handler: handler}) - self61.AddToProcessorMap("getDescribeInfo", &topicServiceProcessorGetDescribeInfo{handler: handler}) - self61.AddToProcessorMap("getTopicAttribute", &topicServiceProcessorGetTopicAttribute{handler: handler}) - self61.AddToProcessorMap("listTopicsInfo", &topicServiceProcessorListTopicsInfo{handler: handler}) - self61.AddToProcessorMap("listTopics", &topicServiceProcessorListTopics{handler: handler}) - self61.AddToProcessorMap("getBindTopics", &topicServiceProcessorGetBindTopics{handler: handler}) - self61.AddToProcessorMap("setTopicQuota", &topicServiceProcessorSetTopicQuota{handler: handler}) - self61.AddToProcessorMap("queryTopicQuota", &topicServiceProcessorQueryTopicQuota{handler: handler}) - self61.AddToProcessorMap("deleteTopicQuota", &topicServiceProcessorDeleteTopicQuota{handler: handler}) - self61.AddToProcessorMap("setPermission", &topicServiceProcessorSetPermission{handler: handler}) - self61.AddToProcessorMap("revokePermission", &topicServiceProcessorRevokePermission{handler: handler}) - self61.AddToProcessorMap("listPermission", &topicServiceProcessorListPermission{handler: handler}) - self61.AddToProcessorMap("getPermission", &topicServiceProcessorGetPermission{handler: handler}) - self61.AddToProcessorMap("addSubResourceName", &topicServiceProcessorAddSubResourceName{handler: handler}) - return self61 + self62 := &TopicServiceProcessor{common.NewTalosBaseServiceProcessor(handler)} + self62.AddToProcessorMap("createTopic", &topicServiceProcessorCreateTopic{handler: handler}) + self62.AddToProcessorMap("createReplicationTopic", &topicServiceProcessorCreateReplicationTopic{handler: handler}) + self62.AddToProcessorMap("createTopicGroup", &topicServiceProcessorCreateTopicGroup{handler: handler}) + self62.AddToProcessorMap("describeTopicGroup", &topicServiceProcessorDescribeTopicGroup{handler: handler}) + self62.AddToProcessorMap("deleteTopicGroup", &topicServiceProcessorDeleteTopicGroup{handler: handler}) + self62.AddToProcessorMap("listTopicGroup", &topicServiceProcessorListTopicGroup{handler: handler}) + self62.AddToProcessorMap("deleteTopic", &topicServiceProcessorDeleteTopic{handler: handler}) + self62.AddToProcessorMap("changeTopicAttribute", &topicServiceProcessorChangeTopicAttribute{handler: handler}) + self62.AddToProcessorMap("describeTopic", &topicServiceProcessorDescribeTopic{handler: handler}) + self62.AddToProcessorMap("getDescribeInfo", &topicServiceProcessorGetDescribeInfo{handler: handler}) + self62.AddToProcessorMap("getTopicAttribute", &topicServiceProcessorGetTopicAttribute{handler: handler}) + self62.AddToProcessorMap("listTopicsInfo", &topicServiceProcessorListTopicsInfo{handler: handler}) + self62.AddToProcessorMap("listTopics", &topicServiceProcessorListTopics{handler: handler}) + self62.AddToProcessorMap("getBindTopics", &topicServiceProcessorGetBindTopics{handler: handler}) + self62.AddToProcessorMap("setTopicQuota", &topicServiceProcessorSetTopicQuota{handler: handler}) + self62.AddToProcessorMap("queryTopicQuota", &topicServiceProcessorQueryTopicQuota{handler: handler}) + self62.AddToProcessorMap("deleteTopicQuota", &topicServiceProcessorDeleteTopicQuota{handler: handler}) + self62.AddToProcessorMap("setPermission", &topicServiceProcessorSetPermission{handler: handler}) + self62.AddToProcessorMap("revokePermission", &topicServiceProcessorRevokePermission{handler: handler}) + self62.AddToProcessorMap("listPermission", &topicServiceProcessorListPermission{handler: handler}) + self62.AddToProcessorMap("getPermission", &topicServiceProcessorGetPermission{handler: handler}) + self62.AddToProcessorMap("addSubResourceName", &topicServiceProcessorAddSubResourceName{handler: handler}) + return self62 } type topicServiceProcessorCreateTopic struct { diff --git a/thrift/topic/ttypes.go b/thrift/topic/ttypes.go index 69c0cf6..6a2c353 100644 --- a/thrift/topic/ttypes.go +++ b/thrift/topic/ttypes.go @@ -426,10 +426,155 @@ func (p *TopicAndPartition) String() string { return fmt.Sprintf("TopicAndPartition(%+v)", *p) } +type TopicOwnerInfo struct { + ChargeId *string `thrift:"chargeId,1" json:"chargeId"` + OwnerName *string `thrift:"ownerName,2" json:"ownerName"` +} + +func NewTopicOwnerInfo() *TopicOwnerInfo { + return &TopicOwnerInfo{} +} + +var TopicOwnerInfo_ChargeId_DEFAULT string + +func (p *TopicOwnerInfo) GetChargeId() string { + if !p.IsSetChargeId() { + return TopicOwnerInfo_ChargeId_DEFAULT + } + return *p.ChargeId +} + +var TopicOwnerInfo_OwnerName_DEFAULT string + +func (p *TopicOwnerInfo) GetOwnerName() string { + if !p.IsSetOwnerName() { + return TopicOwnerInfo_OwnerName_DEFAULT + } + return *p.OwnerName +} +func (p *TopicOwnerInfo) IsSetChargeId() bool { + return p.ChargeId != nil +} + +func (p *TopicOwnerInfo) IsSetOwnerName() bool { + return p.OwnerName != nil +} + +func (p *TopicOwnerInfo) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return fmt.Errorf("%T read error: %s", p, err) + } + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + case 2: + if err := p.ReadField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return fmt.Errorf("%T read struct end error: %s", p, err) + } + return nil +} + +func (p *TopicOwnerInfo) ReadField1(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return fmt.Errorf("error reading field 1: %s", err) + } else { + p.ChargeId = &v + } + return nil +} + +func (p *TopicOwnerInfo) ReadField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return fmt.Errorf("error reading field 2: %s", err) + } else { + p.OwnerName = &v + } + return nil +} + +func (p *TopicOwnerInfo) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("TopicOwnerInfo"); err != nil { + return fmt.Errorf("%T write struct begin error: %s", p, err) + } + 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 fmt.Errorf("write field stop error: %s", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return fmt.Errorf("write struct stop error: %s", err) + } + return nil +} + +func (p *TopicOwnerInfo) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetChargeId() { + if err := oprot.WriteFieldBegin("chargeId", thrift.STRING, 1); err != nil { + return fmt.Errorf("%T write field begin error 1:chargeId: %s", p, err) + } + if err := oprot.WriteString(string(*p.ChargeId)); err != nil { + return fmt.Errorf("%T.chargeId (1) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 1:chargeId: %s", p, err) + } + } + return err +} + +func (p *TopicOwnerInfo) writeField2(oprot thrift.TProtocol) (err error) { + if p.IsSetOwnerName() { + if err := oprot.WriteFieldBegin("ownerName", thrift.STRING, 2); err != nil { + return fmt.Errorf("%T write field begin error 2:ownerName: %s", p, err) + } + if err := oprot.WriteString(string(*p.OwnerName)); err != nil { + return fmt.Errorf("%T.ownerName (2) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 2:ownerName: %s", p, err) + } + } + return err +} + +func (p *TopicOwnerInfo) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TopicOwnerInfo(%+v)", *p) +} + type TopicInfo struct { TopicName string `thrift:"topicName,1,required" json:"topicName"` TopicTalosResourceName *TopicTalosResourceName `thrift:"topicTalosResourceName,2,required" json:"topicTalosResourceName"` OwnerId string `thrift:"ownerId,3,required" json:"ownerId"` + OwnerInfo *TopicOwnerInfo `thrift:"ownerInfo,4" json:"ownerInfo"` } func NewTopicInfo() *TopicInfo { @@ -452,10 +597,23 @@ func (p *TopicInfo) GetTopicTalosResourceName() *TopicTalosResourceName { func (p *TopicInfo) GetOwnerId() string { return p.OwnerId } + +var TopicInfo_OwnerInfo_DEFAULT *TopicOwnerInfo + +func (p *TopicInfo) GetOwnerInfo() *TopicOwnerInfo { + if !p.IsSetOwnerInfo() { + return TopicInfo_OwnerInfo_DEFAULT + } + return p.OwnerInfo +} func (p *TopicInfo) IsSetTopicTalosResourceName() bool { return p.TopicTalosResourceName != nil } +func (p *TopicInfo) IsSetOwnerInfo() bool { + return p.OwnerInfo != nil +} + func (p *TopicInfo) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return fmt.Errorf("%T read error: %s", p, err) @@ -481,6 +639,10 @@ func (p *TopicInfo) Read(iprot thrift.TProtocol) error { if err := p.ReadField3(iprot); err != nil { return err } + case 4: + if err := p.ReadField4(iprot); err != nil { + return err + } default: if err := iprot.Skip(fieldTypeId); err != nil { return err @@ -522,6 +684,14 @@ func (p *TopicInfo) ReadField3(iprot thrift.TProtocol) error { return nil } +func (p *TopicInfo) ReadField4(iprot thrift.TProtocol) error { + p.OwnerInfo = &TopicOwnerInfo{} + if err := p.OwnerInfo.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", p.OwnerInfo, err) + } + return nil +} + func (p *TopicInfo) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("TopicInfo"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) @@ -535,6 +705,9 @@ func (p *TopicInfo) Write(oprot thrift.TProtocol) error { if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField4(oprot); err != nil { + return err + } if err := oprot.WriteFieldStop(); err != nil { return fmt.Errorf("write field stop error: %s", err) } @@ -583,6 +756,21 @@ func (p *TopicInfo) writeField3(oprot thrift.TProtocol) (err error) { return err } +func (p *TopicInfo) writeField4(oprot thrift.TProtocol) (err error) { + if p.IsSetOwnerInfo() { + if err := oprot.WriteFieldBegin("ownerInfo", thrift.STRUCT, 4); err != nil { + return fmt.Errorf("%T write field begin error 4:ownerInfo: %s", p, err) + } + if err := p.OwnerInfo.Write(oprot); err != nil { + return fmt.Errorf("%T error writing struct: %s", p.OwnerInfo, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 4:ownerInfo: %s", p, err) + } + } + return err +} + func (p *TopicInfo) String() string { if p == nil { return "" @@ -590,6 +778,172 @@ func (p *TopicInfo) String() string { return fmt.Sprintf("TopicInfo(%+v)", *p) } +type SourceTopicInfo struct { + SourceCluster string `thrift:"sourceCluster,1,required" json:"sourceCluster"` + TopicName string `thrift:"topicName,2,required" json:"topicName"` + SourceTopic *DescribeTopicResponse `thrift:"sourceTopic,3" json:"sourceTopic"` +} + +func NewSourceTopicInfo() *SourceTopicInfo { + return &SourceTopicInfo{} +} + +func (p *SourceTopicInfo) GetSourceCluster() string { + return p.SourceCluster +} + +func (p *SourceTopicInfo) GetTopicName() string { + return p.TopicName +} + +var SourceTopicInfo_SourceTopic_DEFAULT DescribeTopicResponse + +func (p *SourceTopicInfo) GetSourceTopic() DescribeTopicResponse { + if !p.IsSetSourceTopic() { + return SourceTopicInfo_SourceTopic_DEFAULT + } + return *p.SourceTopic +} +func (p *SourceTopicInfo) IsSetSourceTopic() bool { + return p.SourceTopic != nil +} + +func (p *SourceTopicInfo) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return fmt.Errorf("%T read error: %s", p, err) + } + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + case 2: + if err := p.ReadField2(iprot); err != nil { + return err + } + case 3: + if err := p.ReadField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return fmt.Errorf("%T read struct end error: %s", p, err) + } + return nil +} + +func (p *SourceTopicInfo) ReadField1(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return fmt.Errorf("error reading field 1: %s", err) + } else { + p.SourceCluster = v + } + return nil +} + +func (p *SourceTopicInfo) ReadField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return fmt.Errorf("error reading field 2: %s", err) + } else { + p.TopicName = v + } + return nil +} + +func (p *SourceTopicInfo) ReadField3(iprot thrift.TProtocol) error { + p.SourceTopic = &DescribeTopicResponse{} + if err := p.SourceTopic.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", p.SourceTopic, err) + } + return nil +} + +func (p *SourceTopicInfo) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("SourceTopicInfo"); err != nil { + return fmt.Errorf("%T write struct begin error: %s", p, err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return fmt.Errorf("write field stop error: %s", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return fmt.Errorf("write struct stop error: %s", err) + } + return nil +} + +func (p *SourceTopicInfo) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("sourceCluster", thrift.STRING, 1); err != nil { + return fmt.Errorf("%T write field begin error 1:sourceCluster: %s", p, err) + } + if err := oprot.WriteString(string(p.SourceCluster)); err != nil { + return fmt.Errorf("%T.sourceCluster (1) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 1:sourceCluster: %s", p, err) + } + return err +} + +func (p *SourceTopicInfo) writeField2(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("topicName", thrift.STRING, 2); err != nil { + return fmt.Errorf("%T write field begin error 2:topicName: %s", p, err) + } + if err := oprot.WriteString(string(p.TopicName)); err != nil { + return fmt.Errorf("%T.topicName (2) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 2:topicName: %s", p, err) + } + return err +} + +func (p *SourceTopicInfo) writeField3(oprot thrift.TProtocol) (err error) { + if p.IsSetSourceTopic() { + if err := oprot.WriteFieldBegin("sourceTopic", thrift.STRUCT, 3); err != nil { + return fmt.Errorf("%T write field begin error 3:sourceTopic: %s", p, err) + } + if err := p.SourceTopic.Write(oprot); err != nil { + return fmt.Errorf("%T error writing struct: %s", p.SourceTopic, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 3:sourceTopic: %s", p, err) + } + } + return err +} + +func (p *SourceTopicInfo) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("SourceTopicInfo(%+v)", *p) +} + type TopicAttribute struct { PartitionNumber *int32 `thrift:"partitionNumber,1" json:"partitionNumber"` MessageRetentionSecs *int32 `thrift:"messageRetentionSecs,2" json:"messageRetentionSecs"` @@ -1796,12 +2150,12 @@ func (p *Topic) String() string { } type TopicGroup struct { - TopicGroupName string `thrift:"topicGroupName,1,required" json:"topicGroupName"` - OwnerId string `thrift:"ownerId,2,required" json:"ownerId"` - TypeA1 *TopicGroupType `thrift:"type,3" json:"type"` - TopicPattern *string `thrift:"topicPattern,4" json:"topicPattern"` - TopicSet []string `thrift:"topicSet,5" json:"topicSet"` - ExclusiveTopics []string `thrift:"exclusiveTopics,6" json:"exclusiveTopics"` + TopicGroupName string `thrift:"topicGroupName,1,required" json:"topicGroupName"` + OwnerId string `thrift:"ownerId,2,required" json:"ownerId"` + TypeA1 TopicGroupType `thrift:"type,3,required" json:"type"` + TopicPattern *string `thrift:"topicPattern,4" json:"topicPattern"` + TopicSet []string `thrift:"topicSet,5" json:"topicSet"` + ExclusiveTopics []string `thrift:"exclusiveTopics,6" json:"exclusiveTopics"` } func NewTopicGroup() *TopicGroup { @@ -1816,13 +2170,8 @@ func (p *TopicGroup) GetOwnerId() string { return p.OwnerId } -var TopicGroup_TypeA1_DEFAULT TopicGroupType - func (p *TopicGroup) GetTypeA1() TopicGroupType { - if !p.IsSetTypeA1() { - return TopicGroup_TypeA1_DEFAULT - } - return *p.TypeA1 + return p.TypeA1 } var TopicGroup_TopicPattern_DEFAULT string @@ -1845,10 +2194,6 @@ var TopicGroup_ExclusiveTopics_DEFAULT []string func (p *TopicGroup) GetExclusiveTopics() []string { return p.ExclusiveTopics } -func (p *TopicGroup) IsSetTypeA1() bool { - return p.TypeA1 != nil -} - func (p *TopicGroup) IsSetTopicPattern() bool { return p.TopicPattern != nil } @@ -1936,7 +2281,7 @@ func (p *TopicGroup) ReadField3(iprot thrift.TProtocol) error { return fmt.Errorf("error reading field 3: %s", err) } else { temp := TopicGroupType(v) - p.TypeA1 = &temp + p.TypeA1 = temp } return nil } @@ -2052,16 +2397,14 @@ func (p *TopicGroup) writeField2(oprot thrift.TProtocol) (err error) { } func (p *TopicGroup) writeField3(oprot thrift.TProtocol) (err error) { - if p.IsSetTypeA1() { - if err := oprot.WriteFieldBegin("type", thrift.I32, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:type: %s", p, err) - } - if err := oprot.WriteI32(int32(*p.TypeA1)); err != nil { - return fmt.Errorf("%T.type (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:type: %s", p, err) - } + if err := oprot.WriteFieldBegin("type", thrift.I32, 3); err != nil { + return fmt.Errorf("%T write field begin error 3:type: %s", p, err) + } + if err := oprot.WriteI32(int32(p.TypeA1)); err != nil { + return fmt.Errorf("%T.type (3) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 3:type: %s", p, err) } return err } @@ -2139,6 +2482,7 @@ type CreateTopicRequest struct { TopicAttribute *TopicAttribute `thrift:"topicAttribute,2,required" json:"topicAttribute"` TopicQuota *quota.BaseQuota `thrift:"topicQuota,3" json:"topicQuota"` AclMap map[*authorization.Grantee]Permission `thrift:"aclMap,4" json:"aclMap"` + OwnerName *string `thrift:"ownerName,5" json:"ownerName"` } func NewCreateTopicRequest() *CreateTopicRequest { @@ -2172,6 +2516,15 @@ var CreateTopicRequest_AclMap_DEFAULT map[*authorization.Grantee]Permission func (p *CreateTopicRequest) GetAclMap() map[*authorization.Grantee]Permission { return p.AclMap } + +var CreateTopicRequest_OwnerName_DEFAULT string + +func (p *CreateTopicRequest) GetOwnerName() string { + if !p.IsSetOwnerName() { + return CreateTopicRequest_OwnerName_DEFAULT + } + return *p.OwnerName +} func (p *CreateTopicRequest) IsSetTopicAttribute() bool { return p.TopicAttribute != nil } @@ -2184,6 +2537,10 @@ func (p *CreateTopicRequest) IsSetAclMap() bool { return p.AclMap != nil } +func (p *CreateTopicRequest) IsSetOwnerName() bool { + return p.OwnerName != nil +} + func (p *CreateTopicRequest) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return fmt.Errorf("%T read error: %s", p, err) @@ -2213,6 +2570,10 @@ func (p *CreateTopicRequest) Read(iprot thrift.TProtocol) error { if err := p.ReadField4(iprot); err != nil { return err } + case 5: + if err := p.ReadField5(iprot); err != nil { + return err + } default: if err := iprot.Skip(fieldTypeId); err != nil { return err @@ -2280,6 +2641,15 @@ func (p *CreateTopicRequest) ReadField4(iprot thrift.TProtocol) error { return nil } +func (p *CreateTopicRequest) ReadField5(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return fmt.Errorf("error reading field 5: %s", err) + } else { + p.OwnerName = &v + } + return nil +} + func (p *CreateTopicRequest) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("CreateTopicRequest"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) @@ -2296,6 +2666,9 @@ func (p *CreateTopicRequest) Write(oprot thrift.TProtocol) error { if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField5(oprot); err != nil { + return err + } if err := oprot.WriteFieldStop(); err != nil { return fmt.Errorf("write field stop error: %s", err) } @@ -2372,6 +2745,21 @@ func (p *CreateTopicRequest) writeField4(oprot thrift.TProtocol) (err error) { return err } +func (p *CreateTopicRequest) writeField5(oprot thrift.TProtocol) (err error) { + if p.IsSetOwnerName() { + if err := oprot.WriteFieldBegin("ownerName", thrift.STRING, 5); err != nil { + return fmt.Errorf("%T write field begin error 5:ownerName: %s", p, err) + } + if err := oprot.WriteString(string(*p.OwnerName)); err != nil { + return fmt.Errorf("%T.ownerName (5) field write error: %s", p, err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return fmt.Errorf("%T write field end error 5:ownerName: %s", p, err) + } + } + return err +} + func (p *CreateTopicRequest) String() string { if p == nil { return "" @@ -2380,9 +2768,8 @@ func (p *CreateTopicRequest) String() string { } type CreateReplicationTopicRequest struct { - TopicName string `thrift:"topicName,1,required" json:"topicName"` - SourceClusterList string `thrift:"sourceClusterList,2,required" json:"sourceClusterList"` - SourceTopicName string `thrift:"sourceTopicName,3,required" json:"sourceTopicName"` + TopicName string `thrift:"topicName,1,required" json:"topicName"` + SourceTopicInfoList []*SourceTopicInfo `thrift:"sourceTopicInfoList,2,required" json:"sourceTopicInfoList"` } func NewCreateReplicationTopicRequest() *CreateReplicationTopicRequest { @@ -2393,12 +2780,8 @@ func (p *CreateReplicationTopicRequest) GetTopicName() string { return p.TopicName } -func (p *CreateReplicationTopicRequest) GetSourceClusterList() string { - return p.SourceClusterList -} - -func (p *CreateReplicationTopicRequest) GetSourceTopicName() string { - return p.SourceTopicName +func (p *CreateReplicationTopicRequest) GetSourceTopicInfoList() []*SourceTopicInfo { + return p.SourceTopicInfoList } func (p *CreateReplicationTopicRequest) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { @@ -2421,10 +2804,6 @@ func (p *CreateReplicationTopicRequest) Read(iprot thrift.TProtocol) error { if err := p.ReadField2(iprot); err != nil { return err } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } default: if err := iprot.Skip(fieldTypeId); err != nil { return err @@ -2450,19 +2829,21 @@ func (p *CreateReplicationTopicRequest) ReadField1(iprot thrift.TProtocol) error } func (p *CreateReplicationTopicRequest) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.SourceClusterList = v + _, size, err := iprot.ReadListBegin() + if err != nil { + return fmt.Errorf("error reading list begin: %s", err) } - return nil -} - -func (p *CreateReplicationTopicRequest) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - p.SourceTopicName = v + tSlice := make([]*SourceTopicInfo, 0, size) + p.SourceTopicInfoList = tSlice + for i := 0; i < size; i++ { + _elem9 := &SourceTopicInfo{} + if err := _elem9.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _elem9, err) + } + p.SourceTopicInfoList = append(p.SourceTopicInfoList, _elem9) + } + if err := iprot.ReadListEnd(); err != nil { + return fmt.Errorf("error reading list end: %s", err) } return nil } @@ -2477,9 +2858,6 @@ func (p *CreateReplicationTopicRequest) Write(oprot thrift.TProtocol) error { if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { - return err - } if err := oprot.WriteFieldStop(); err != nil { return fmt.Errorf("write field stop error: %s", err) } @@ -2503,27 +2881,22 @@ func (p *CreateReplicationTopicRequest) writeField1(oprot thrift.TProtocol) (err } func (p *CreateReplicationTopicRequest) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("sourceClusterList", thrift.STRING, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:sourceClusterList: %s", p, err) + if err := oprot.WriteFieldBegin("sourceTopicInfoList", thrift.LIST, 2); err != nil { + return fmt.Errorf("%T write field begin error 2:sourceTopicInfoList: %s", p, err) } - if err := oprot.WriteString(string(p.SourceClusterList)); err != nil { - return fmt.Errorf("%T.sourceClusterList (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:sourceClusterList: %s", p, err) + if err := oprot.WriteListBegin(thrift.STRUCT, len(p.SourceTopicInfoList)); err != nil { + return fmt.Errorf("error writing list begin: %s", err) } - return err -} - -func (p *CreateReplicationTopicRequest) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("sourceTopicName", thrift.STRING, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:sourceTopicName: %s", p, err) + for _, v := range p.SourceTopicInfoList { + if err := v.Write(oprot); err != nil { + return fmt.Errorf("%T error writing struct: %s", v, err) + } } - if err := oprot.WriteString(string(p.SourceTopicName)); err != nil { - return fmt.Errorf("%T.sourceTopicName (3) field write error: %s", p, err) + if err := oprot.WriteListEnd(); err != nil { + return fmt.Errorf("error writing list end: %s", err) } if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:sourceTopicName: %s", p, err) + return fmt.Errorf("%T write field end error 2:sourceTopicInfoList: %s", p, err) } return err } @@ -3758,7 +4131,7 @@ func (p *DeleteTopicGroupRequest) String() string { } type ListTopicGroupRequest struct { - OrgList []string `thrift:"orgList,1,required" json:"orgList"` + OrgList []string `thrift:"OrgList,1,required" json:"OrgList"` } func NewListTopicGroupRequest() *ListTopicGroupRequest { @@ -3808,13 +4181,13 @@ func (p *ListTopicGroupRequest) ReadField1(iprot thrift.TProtocol) error { tSlice := make([]string, 0, size) p.OrgList = tSlice for i := 0; i < size; i++ { - var _elem9 string + var _elem10 string if v, err := iprot.ReadString(); err != nil { return fmt.Errorf("error reading field 0: %s", err) } else { - _elem9 = v + _elem10 = v } - p.OrgList = append(p.OrgList, _elem9) + p.OrgList = append(p.OrgList, _elem10) } if err := iprot.ReadListEnd(); err != nil { return fmt.Errorf("error reading list end: %s", err) @@ -3839,8 +4212,8 @@ func (p *ListTopicGroupRequest) Write(oprot thrift.TProtocol) error { } func (p *ListTopicGroupRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("orgList", thrift.LIST, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:orgList: %s", p, err) + if err := oprot.WriteFieldBegin("OrgList", thrift.LIST, 1); err != nil { + return fmt.Errorf("%T write field begin error 1:OrgList: %s", p, err) } if err := oprot.WriteListBegin(thrift.STRING, len(p.OrgList)); err != nil { return fmt.Errorf("error writing list begin: %s", err) @@ -3854,7 +4227,7 @@ func (p *ListTopicGroupRequest) writeField1(oprot thrift.TProtocol) (err error) return fmt.Errorf("error writing list end: %s", err) } if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:orgList: %s", p, err) + return fmt.Errorf("%T write field end error 1:OrgList: %s", p, err) } return err } @@ -3917,11 +4290,11 @@ func (p *ListTopicGroupResponse) ReadField1(iprot thrift.TProtocol) error { tSlice := make([]*TopicGroup, 0, size) p.TopicGroupList = tSlice for i := 0; i < size; i++ { - _elem10 := &TopicGroup{} - if err := _elem10.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem10, err) + _elem11 := &TopicGroup{} + if err := _elem11.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _elem11, err) } - p.TopicGroupList = append(p.TopicGroupList, _elem10) + p.TopicGroupList = append(p.TopicGroupList, _elem11) } if err := iprot.ReadListEnd(); err != nil { return fmt.Errorf("error reading list end: %s", err) @@ -4128,19 +4501,19 @@ func (p *DescribeTopicResponse) ReadField5(iprot thrift.TProtocol) error { tMap := make(map[string]int32, size) p.AclMap = tMap for i := 0; i < size; i++ { - var _key11 string + var _key12 string if v, err := iprot.ReadString(); err != nil { return fmt.Errorf("error reading field 0: %s", err) } else { - _key11 = v + _key12 = v } - var _val12 int32 + var _val13 int32 if v, err := iprot.ReadI32(); err != nil { return fmt.Errorf("error reading field 0: %s", err) } else { - _val12 = v + _val13 = v } - p.AclMap[_key11] = _val12 + p.AclMap[_key12] = _val13 } if err := iprot.ReadMapEnd(); err != nil { return fmt.Errorf("error reading map end: %s", err) @@ -4578,11 +4951,11 @@ func (p *ListTopicsResponse) ReadField1(iprot thrift.TProtocol) error { tSlice := make([]*TopicInfo, 0, size) p.TopicInfos = tSlice for i := 0; i < size; i++ { - _elem13 := &TopicInfo{} - if err := _elem13.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem13, err) + _elem14 := &TopicInfo{} + if err := _elem14.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _elem14, err) } - p.TopicInfos = append(p.TopicInfos, _elem13) + p.TopicInfos = append(p.TopicInfos, _elem14) } if err := iprot.ReadListEnd(); err != nil { return fmt.Errorf("error reading list end: %s", err) @@ -4685,11 +5058,11 @@ func (p *ListTopicsInfoResponse) ReadField1(iprot thrift.TProtocol) error { tSlice := make([]*Topic, 0, size) p.TopicList = tSlice for i := 0; i < size; i++ { - _elem14 := &Topic{} - if err := _elem14.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem14, err) + _elem15 := &Topic{} + if err := _elem15.Read(iprot); err != nil { + return fmt.Errorf("%T error reading struct: %s", _elem15, err) } - p.TopicList = append(p.TopicList, _elem14) + p.TopicList = append(p.TopicList, _elem15) } if err := iprot.ReadListEnd(); err != nil { return fmt.Errorf("error reading list end: %s", err) @@ -5625,19 +5998,19 @@ func (p *ListPermissionResponse) ReadField1(iprot thrift.TProtocol) error { tMap := make(map[string]int32, size) p.Permissions = tMap for i := 0; i < size; i++ { - var _key15 string + var _key16 string if v, err := iprot.ReadString(); err != nil { return fmt.Errorf("error reading field 0: %s", err) } else { - _key15 = v + _key16 = v } - var _val16 int32 + var _val17 int32 if v, err := iprot.ReadI32(); err != nil { return fmt.Errorf("error reading field 0: %s", err) } else { - _val16 = v + _val17 = v } - p.Permissions[_key15] = _val16 + p.Permissions[_key16] = _val17 } if err := iprot.ReadMapEnd(); err != nil { return fmt.Errorf("error reading map end: %s", err)