github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/trace/topic_gtrace.go (about)

     1  // Code generated by gtrace. DO NOT EDIT.
     2  
     3  package trace
     4  
     5  import (
     6  	"context"
     7  )
     8  
     9  // topicComposeOptions is a holder of options
    10  type topicComposeOptions struct {
    11  	panicCallback func(e interface{})
    12  }
    13  
    14  // TopicOption specified Topic compose option
    15  type TopicComposeOption func(o *topicComposeOptions)
    16  
    17  // WithTopicPanicCallback specified behavior on panic
    18  func WithTopicPanicCallback(cb func(e interface{})) TopicComposeOption {
    19  	return func(o *topicComposeOptions) {
    20  		o.panicCallback = cb
    21  	}
    22  }
    23  
    24  // Compose returns a new Topic which has functional fields composed both from t and x.
    25  func (t *Topic) Compose(x *Topic, opts ...TopicComposeOption) *Topic {
    26  	var ret Topic
    27  	options := topicComposeOptions{}
    28  	for _, opt := range opts {
    29  		if opt != nil {
    30  			opt(&options)
    31  		}
    32  	}
    33  	{
    34  		h1 := t.OnReaderStart
    35  		h2 := x.OnReaderStart
    36  		ret.OnReaderStart = func(info TopicReaderStartInfo) {
    37  			if options.panicCallback != nil {
    38  				defer func() {
    39  					if e := recover(); e != nil {
    40  						options.panicCallback(e)
    41  					}
    42  				}()
    43  			}
    44  			if h1 != nil {
    45  				h1(info)
    46  			}
    47  			if h2 != nil {
    48  				h2(info)
    49  			}
    50  		}
    51  	}
    52  	{
    53  		h1 := t.OnReaderReconnect
    54  		h2 := x.OnReaderReconnect
    55  		ret.OnReaderReconnect = func(t TopicReaderReconnectStartInfo) func(TopicReaderReconnectDoneInfo) {
    56  			if options.panicCallback != nil {
    57  				defer func() {
    58  					if e := recover(); e != nil {
    59  						options.panicCallback(e)
    60  					}
    61  				}()
    62  			}
    63  			var r, r1 func(TopicReaderReconnectDoneInfo)
    64  			if h1 != nil {
    65  				r = h1(t)
    66  			}
    67  			if h2 != nil {
    68  				r1 = h2(t)
    69  			}
    70  			return func(t TopicReaderReconnectDoneInfo) {
    71  				if options.panicCallback != nil {
    72  					defer func() {
    73  						if e := recover(); e != nil {
    74  							options.panicCallback(e)
    75  						}
    76  					}()
    77  				}
    78  				if r != nil {
    79  					r(t)
    80  				}
    81  				if r1 != nil {
    82  					r1(t)
    83  				}
    84  			}
    85  		}
    86  	}
    87  	{
    88  		h1 := t.OnReaderReconnectRequest
    89  		h2 := x.OnReaderReconnectRequest
    90  		ret.OnReaderReconnectRequest = func(t TopicReaderReconnectRequestInfo) {
    91  			if options.panicCallback != nil {
    92  				defer func() {
    93  					if e := recover(); e != nil {
    94  						options.panicCallback(e)
    95  					}
    96  				}()
    97  			}
    98  			if h1 != nil {
    99  				h1(t)
   100  			}
   101  			if h2 != nil {
   102  				h2(t)
   103  			}
   104  		}
   105  	}
   106  	{
   107  		h1 := t.OnReaderPartitionReadStartResponse
   108  		h2 := x.OnReaderPartitionReadStartResponse
   109  		ret.OnReaderPartitionReadStartResponse = func(t TopicReaderPartitionReadStartResponseStartInfo) func(TopicReaderPartitionReadStartResponseDoneInfo) {
   110  			if options.panicCallback != nil {
   111  				defer func() {
   112  					if e := recover(); e != nil {
   113  						options.panicCallback(e)
   114  					}
   115  				}()
   116  			}
   117  			var r, r1 func(TopicReaderPartitionReadStartResponseDoneInfo)
   118  			if h1 != nil {
   119  				r = h1(t)
   120  			}
   121  			if h2 != nil {
   122  				r1 = h2(t)
   123  			}
   124  			return func(t TopicReaderPartitionReadStartResponseDoneInfo) {
   125  				if options.panicCallback != nil {
   126  					defer func() {
   127  						if e := recover(); e != nil {
   128  							options.panicCallback(e)
   129  						}
   130  					}()
   131  				}
   132  				if r != nil {
   133  					r(t)
   134  				}
   135  				if r1 != nil {
   136  					r1(t)
   137  				}
   138  			}
   139  		}
   140  	}
   141  	{
   142  		h1 := t.OnReaderPartitionReadStopResponse
   143  		h2 := x.OnReaderPartitionReadStopResponse
   144  		ret.OnReaderPartitionReadStopResponse = func(t TopicReaderPartitionReadStopResponseStartInfo) func(TopicReaderPartitionReadStopResponseDoneInfo) {
   145  			if options.panicCallback != nil {
   146  				defer func() {
   147  					if e := recover(); e != nil {
   148  						options.panicCallback(e)
   149  					}
   150  				}()
   151  			}
   152  			var r, r1 func(TopicReaderPartitionReadStopResponseDoneInfo)
   153  			if h1 != nil {
   154  				r = h1(t)
   155  			}
   156  			if h2 != nil {
   157  				r1 = h2(t)
   158  			}
   159  			return func(t TopicReaderPartitionReadStopResponseDoneInfo) {
   160  				if options.panicCallback != nil {
   161  					defer func() {
   162  						if e := recover(); e != nil {
   163  							options.panicCallback(e)
   164  						}
   165  					}()
   166  				}
   167  				if r != nil {
   168  					r(t)
   169  				}
   170  				if r1 != nil {
   171  					r1(t)
   172  				}
   173  			}
   174  		}
   175  	}
   176  	{
   177  		h1 := t.OnReaderCommit
   178  		h2 := x.OnReaderCommit
   179  		ret.OnReaderCommit = func(t TopicReaderCommitStartInfo) func(TopicReaderCommitDoneInfo) {
   180  			if options.panicCallback != nil {
   181  				defer func() {
   182  					if e := recover(); e != nil {
   183  						options.panicCallback(e)
   184  					}
   185  				}()
   186  			}
   187  			var r, r1 func(TopicReaderCommitDoneInfo)
   188  			if h1 != nil {
   189  				r = h1(t)
   190  			}
   191  			if h2 != nil {
   192  				r1 = h2(t)
   193  			}
   194  			return func(t TopicReaderCommitDoneInfo) {
   195  				if options.panicCallback != nil {
   196  					defer func() {
   197  						if e := recover(); e != nil {
   198  							options.panicCallback(e)
   199  						}
   200  					}()
   201  				}
   202  				if r != nil {
   203  					r(t)
   204  				}
   205  				if r1 != nil {
   206  					r1(t)
   207  				}
   208  			}
   209  		}
   210  	}
   211  	{
   212  		h1 := t.OnReaderSendCommitMessage
   213  		h2 := x.OnReaderSendCommitMessage
   214  		ret.OnReaderSendCommitMessage = func(t TopicReaderSendCommitMessageStartInfo) func(TopicReaderSendCommitMessageDoneInfo) {
   215  			if options.panicCallback != nil {
   216  				defer func() {
   217  					if e := recover(); e != nil {
   218  						options.panicCallback(e)
   219  					}
   220  				}()
   221  			}
   222  			var r, r1 func(TopicReaderSendCommitMessageDoneInfo)
   223  			if h1 != nil {
   224  				r = h1(t)
   225  			}
   226  			if h2 != nil {
   227  				r1 = h2(t)
   228  			}
   229  			return func(t TopicReaderSendCommitMessageDoneInfo) {
   230  				if options.panicCallback != nil {
   231  					defer func() {
   232  						if e := recover(); e != nil {
   233  							options.panicCallback(e)
   234  						}
   235  					}()
   236  				}
   237  				if r != nil {
   238  					r(t)
   239  				}
   240  				if r1 != nil {
   241  					r1(t)
   242  				}
   243  			}
   244  		}
   245  	}
   246  	{
   247  		h1 := t.OnReaderCommittedNotify
   248  		h2 := x.OnReaderCommittedNotify
   249  		ret.OnReaderCommittedNotify = func(t TopicReaderCommittedNotifyInfo) {
   250  			if options.panicCallback != nil {
   251  				defer func() {
   252  					if e := recover(); e != nil {
   253  						options.panicCallback(e)
   254  					}
   255  				}()
   256  			}
   257  			if h1 != nil {
   258  				h1(t)
   259  			}
   260  			if h2 != nil {
   261  				h2(t)
   262  			}
   263  		}
   264  	}
   265  	{
   266  		h1 := t.OnReaderClose
   267  		h2 := x.OnReaderClose
   268  		ret.OnReaderClose = func(t TopicReaderCloseStartInfo) func(TopicReaderCloseDoneInfo) {
   269  			if options.panicCallback != nil {
   270  				defer func() {
   271  					if e := recover(); e != nil {
   272  						options.panicCallback(e)
   273  					}
   274  				}()
   275  			}
   276  			var r, r1 func(TopicReaderCloseDoneInfo)
   277  			if h1 != nil {
   278  				r = h1(t)
   279  			}
   280  			if h2 != nil {
   281  				r1 = h2(t)
   282  			}
   283  			return func(t TopicReaderCloseDoneInfo) {
   284  				if options.panicCallback != nil {
   285  					defer func() {
   286  						if e := recover(); e != nil {
   287  							options.panicCallback(e)
   288  						}
   289  					}()
   290  				}
   291  				if r != nil {
   292  					r(t)
   293  				}
   294  				if r1 != nil {
   295  					r1(t)
   296  				}
   297  			}
   298  		}
   299  	}
   300  	{
   301  		h1 := t.OnReaderInit
   302  		h2 := x.OnReaderInit
   303  		ret.OnReaderInit = func(t TopicReaderInitStartInfo) func(TopicReaderInitDoneInfo) {
   304  			if options.panicCallback != nil {
   305  				defer func() {
   306  					if e := recover(); e != nil {
   307  						options.panicCallback(e)
   308  					}
   309  				}()
   310  			}
   311  			var r, r1 func(TopicReaderInitDoneInfo)
   312  			if h1 != nil {
   313  				r = h1(t)
   314  			}
   315  			if h2 != nil {
   316  				r1 = h2(t)
   317  			}
   318  			return func(t TopicReaderInitDoneInfo) {
   319  				if options.panicCallback != nil {
   320  					defer func() {
   321  						if e := recover(); e != nil {
   322  							options.panicCallback(e)
   323  						}
   324  					}()
   325  				}
   326  				if r != nil {
   327  					r(t)
   328  				}
   329  				if r1 != nil {
   330  					r1(t)
   331  				}
   332  			}
   333  		}
   334  	}
   335  	{
   336  		h1 := t.OnReaderError
   337  		h2 := x.OnReaderError
   338  		ret.OnReaderError = func(t TopicReaderErrorInfo) {
   339  			if options.panicCallback != nil {
   340  				defer func() {
   341  					if e := recover(); e != nil {
   342  						options.panicCallback(e)
   343  					}
   344  				}()
   345  			}
   346  			if h1 != nil {
   347  				h1(t)
   348  			}
   349  			if h2 != nil {
   350  				h2(t)
   351  			}
   352  		}
   353  	}
   354  	{
   355  		h1 := t.OnReaderUpdateToken
   356  		h2 := x.OnReaderUpdateToken
   357  		ret.OnReaderUpdateToken = func(o OnReadUpdateTokenStartInfo) func(OnReadUpdateTokenMiddleTokenReceivedInfo) func(OnReadStreamUpdateTokenDoneInfo) {
   358  			if options.panicCallback != nil {
   359  				defer func() {
   360  					if e := recover(); e != nil {
   361  						options.panicCallback(e)
   362  					}
   363  				}()
   364  			}
   365  			var r, r1 func(OnReadUpdateTokenMiddleTokenReceivedInfo) func(OnReadStreamUpdateTokenDoneInfo)
   366  			if h1 != nil {
   367  				r = h1(o)
   368  			}
   369  			if h2 != nil {
   370  				r1 = h2(o)
   371  			}
   372  			return func(o OnReadUpdateTokenMiddleTokenReceivedInfo) func(OnReadStreamUpdateTokenDoneInfo) {
   373  				if options.panicCallback != nil {
   374  					defer func() {
   375  						if e := recover(); e != nil {
   376  							options.panicCallback(e)
   377  						}
   378  					}()
   379  				}
   380  				var r2, r3 func(OnReadStreamUpdateTokenDoneInfo)
   381  				if r != nil {
   382  					r2 = r(o)
   383  				}
   384  				if r1 != nil {
   385  					r3 = r1(o)
   386  				}
   387  				return func(o OnReadStreamUpdateTokenDoneInfo) {
   388  					if options.panicCallback != nil {
   389  						defer func() {
   390  							if e := recover(); e != nil {
   391  								options.panicCallback(e)
   392  							}
   393  						}()
   394  					}
   395  					if r2 != nil {
   396  						r2(o)
   397  					}
   398  					if r3 != nil {
   399  						r3(o)
   400  					}
   401  				}
   402  			}
   403  		}
   404  	}
   405  	{
   406  		h1 := t.OnReaderSentDataRequest
   407  		h2 := x.OnReaderSentDataRequest
   408  		ret.OnReaderSentDataRequest = func(t TopicReaderSentDataRequestInfo) {
   409  			if options.panicCallback != nil {
   410  				defer func() {
   411  					if e := recover(); e != nil {
   412  						options.panicCallback(e)
   413  					}
   414  				}()
   415  			}
   416  			if h1 != nil {
   417  				h1(t)
   418  			}
   419  			if h2 != nil {
   420  				h2(t)
   421  			}
   422  		}
   423  	}
   424  	{
   425  		h1 := t.OnReaderReceiveDataResponse
   426  		h2 := x.OnReaderReceiveDataResponse
   427  		ret.OnReaderReceiveDataResponse = func(t TopicReaderReceiveDataResponseStartInfo) func(TopicReaderReceiveDataResponseDoneInfo) {
   428  			if options.panicCallback != nil {
   429  				defer func() {
   430  					if e := recover(); e != nil {
   431  						options.panicCallback(e)
   432  					}
   433  				}()
   434  			}
   435  			var r, r1 func(TopicReaderReceiveDataResponseDoneInfo)
   436  			if h1 != nil {
   437  				r = h1(t)
   438  			}
   439  			if h2 != nil {
   440  				r1 = h2(t)
   441  			}
   442  			return func(t TopicReaderReceiveDataResponseDoneInfo) {
   443  				if options.panicCallback != nil {
   444  					defer func() {
   445  						if e := recover(); e != nil {
   446  							options.panicCallback(e)
   447  						}
   448  					}()
   449  				}
   450  				if r != nil {
   451  					r(t)
   452  				}
   453  				if r1 != nil {
   454  					r1(t)
   455  				}
   456  			}
   457  		}
   458  	}
   459  	{
   460  		h1 := t.OnReaderReadMessages
   461  		h2 := x.OnReaderReadMessages
   462  		ret.OnReaderReadMessages = func(t TopicReaderReadMessagesStartInfo) func(TopicReaderReadMessagesDoneInfo) {
   463  			if options.panicCallback != nil {
   464  				defer func() {
   465  					if e := recover(); e != nil {
   466  						options.panicCallback(e)
   467  					}
   468  				}()
   469  			}
   470  			var r, r1 func(TopicReaderReadMessagesDoneInfo)
   471  			if h1 != nil {
   472  				r = h1(t)
   473  			}
   474  			if h2 != nil {
   475  				r1 = h2(t)
   476  			}
   477  			return func(t TopicReaderReadMessagesDoneInfo) {
   478  				if options.panicCallback != nil {
   479  					defer func() {
   480  						if e := recover(); e != nil {
   481  							options.panicCallback(e)
   482  						}
   483  					}()
   484  				}
   485  				if r != nil {
   486  					r(t)
   487  				}
   488  				if r1 != nil {
   489  					r1(t)
   490  				}
   491  			}
   492  		}
   493  	}
   494  	{
   495  		h1 := t.OnReaderUnknownGrpcMessage
   496  		h2 := x.OnReaderUnknownGrpcMessage
   497  		ret.OnReaderUnknownGrpcMessage = func(o OnReadUnknownGrpcMessageInfo) {
   498  			if options.panicCallback != nil {
   499  				defer func() {
   500  					if e := recover(); e != nil {
   501  						options.panicCallback(e)
   502  					}
   503  				}()
   504  			}
   505  			if h1 != nil {
   506  				h1(o)
   507  			}
   508  			if h2 != nil {
   509  				h2(o)
   510  			}
   511  		}
   512  	}
   513  	{
   514  		h1 := t.OnWriterReconnect
   515  		h2 := x.OnWriterReconnect
   516  		ret.OnWriterReconnect = func(t TopicWriterReconnectStartInfo) func(TopicWriterReconnectDoneInfo) {
   517  			if options.panicCallback != nil {
   518  				defer func() {
   519  					if e := recover(); e != nil {
   520  						options.panicCallback(e)
   521  					}
   522  				}()
   523  			}
   524  			var r, r1 func(TopicWriterReconnectDoneInfo)
   525  			if h1 != nil {
   526  				r = h1(t)
   527  			}
   528  			if h2 != nil {
   529  				r1 = h2(t)
   530  			}
   531  			return func(t TopicWriterReconnectDoneInfo) {
   532  				if options.panicCallback != nil {
   533  					defer func() {
   534  						if e := recover(); e != nil {
   535  							options.panicCallback(e)
   536  						}
   537  					}()
   538  				}
   539  				if r != nil {
   540  					r(t)
   541  				}
   542  				if r1 != nil {
   543  					r1(t)
   544  				}
   545  			}
   546  		}
   547  	}
   548  	{
   549  		h1 := t.OnWriterInitStream
   550  		h2 := x.OnWriterInitStream
   551  		ret.OnWriterInitStream = func(t TopicWriterInitStreamStartInfo) func(TopicWriterInitStreamDoneInfo) {
   552  			if options.panicCallback != nil {
   553  				defer func() {
   554  					if e := recover(); e != nil {
   555  						options.panicCallback(e)
   556  					}
   557  				}()
   558  			}
   559  			var r, r1 func(TopicWriterInitStreamDoneInfo)
   560  			if h1 != nil {
   561  				r = h1(t)
   562  			}
   563  			if h2 != nil {
   564  				r1 = h2(t)
   565  			}
   566  			return func(t TopicWriterInitStreamDoneInfo) {
   567  				if options.panicCallback != nil {
   568  					defer func() {
   569  						if e := recover(); e != nil {
   570  							options.panicCallback(e)
   571  						}
   572  					}()
   573  				}
   574  				if r != nil {
   575  					r(t)
   576  				}
   577  				if r1 != nil {
   578  					r1(t)
   579  				}
   580  			}
   581  		}
   582  	}
   583  	{
   584  		h1 := t.OnWriterClose
   585  		h2 := x.OnWriterClose
   586  		ret.OnWriterClose = func(t TopicWriterCloseStartInfo) func(TopicWriterCloseDoneInfo) {
   587  			if options.panicCallback != nil {
   588  				defer func() {
   589  					if e := recover(); e != nil {
   590  						options.panicCallback(e)
   591  					}
   592  				}()
   593  			}
   594  			var r, r1 func(TopicWriterCloseDoneInfo)
   595  			if h1 != nil {
   596  				r = h1(t)
   597  			}
   598  			if h2 != nil {
   599  				r1 = h2(t)
   600  			}
   601  			return func(t TopicWriterCloseDoneInfo) {
   602  				if options.panicCallback != nil {
   603  					defer func() {
   604  						if e := recover(); e != nil {
   605  							options.panicCallback(e)
   606  						}
   607  					}()
   608  				}
   609  				if r != nil {
   610  					r(t)
   611  				}
   612  				if r1 != nil {
   613  					r1(t)
   614  				}
   615  			}
   616  		}
   617  	}
   618  	{
   619  		h1 := t.OnWriterCompressMessages
   620  		h2 := x.OnWriterCompressMessages
   621  		ret.OnWriterCompressMessages = func(t TopicWriterCompressMessagesStartInfo) func(TopicWriterCompressMessagesDoneInfo) {
   622  			if options.panicCallback != nil {
   623  				defer func() {
   624  					if e := recover(); e != nil {
   625  						options.panicCallback(e)
   626  					}
   627  				}()
   628  			}
   629  			var r, r1 func(TopicWriterCompressMessagesDoneInfo)
   630  			if h1 != nil {
   631  				r = h1(t)
   632  			}
   633  			if h2 != nil {
   634  				r1 = h2(t)
   635  			}
   636  			return func(t TopicWriterCompressMessagesDoneInfo) {
   637  				if options.panicCallback != nil {
   638  					defer func() {
   639  						if e := recover(); e != nil {
   640  							options.panicCallback(e)
   641  						}
   642  					}()
   643  				}
   644  				if r != nil {
   645  					r(t)
   646  				}
   647  				if r1 != nil {
   648  					r1(t)
   649  				}
   650  			}
   651  		}
   652  	}
   653  	{
   654  		h1 := t.OnWriterSendMessages
   655  		h2 := x.OnWriterSendMessages
   656  		ret.OnWriterSendMessages = func(t TopicWriterSendMessagesStartInfo) func(TopicWriterSendMessagesDoneInfo) {
   657  			if options.panicCallback != nil {
   658  				defer func() {
   659  					if e := recover(); e != nil {
   660  						options.panicCallback(e)
   661  					}
   662  				}()
   663  			}
   664  			var r, r1 func(TopicWriterSendMessagesDoneInfo)
   665  			if h1 != nil {
   666  				r = h1(t)
   667  			}
   668  			if h2 != nil {
   669  				r1 = h2(t)
   670  			}
   671  			return func(t TopicWriterSendMessagesDoneInfo) {
   672  				if options.panicCallback != nil {
   673  					defer func() {
   674  						if e := recover(); e != nil {
   675  							options.panicCallback(e)
   676  						}
   677  					}()
   678  				}
   679  				if r != nil {
   680  					r(t)
   681  				}
   682  				if r1 != nil {
   683  					r1(t)
   684  				}
   685  			}
   686  		}
   687  	}
   688  	{
   689  		h1 := t.OnWriterReadUnknownGrpcMessage
   690  		h2 := x.OnWriterReadUnknownGrpcMessage
   691  		ret.OnWriterReadUnknownGrpcMessage = func(t TopicOnWriterReadUnknownGrpcMessageInfo) {
   692  			if options.panicCallback != nil {
   693  				defer func() {
   694  					if e := recover(); e != nil {
   695  						options.panicCallback(e)
   696  					}
   697  				}()
   698  			}
   699  			if h1 != nil {
   700  				h1(t)
   701  			}
   702  			if h2 != nil {
   703  				h2(t)
   704  			}
   705  		}
   706  	}
   707  	return &ret
   708  }
   709  func (t *Topic) onReaderStart(info TopicReaderStartInfo) {
   710  	fn := t.OnReaderStart
   711  	if fn == nil {
   712  		return
   713  	}
   714  	fn(info)
   715  }
   716  func (t *Topic) onReaderReconnect(t1 TopicReaderReconnectStartInfo) func(TopicReaderReconnectDoneInfo) {
   717  	fn := t.OnReaderReconnect
   718  	if fn == nil {
   719  		return func(TopicReaderReconnectDoneInfo) {
   720  			return
   721  		}
   722  	}
   723  	res := fn(t1)
   724  	if res == nil {
   725  		return func(TopicReaderReconnectDoneInfo) {
   726  			return
   727  		}
   728  	}
   729  	return res
   730  }
   731  func (t *Topic) onReaderReconnectRequest(t1 TopicReaderReconnectRequestInfo) {
   732  	fn := t.OnReaderReconnectRequest
   733  	if fn == nil {
   734  		return
   735  	}
   736  	fn(t1)
   737  }
   738  func (t *Topic) onReaderPartitionReadStartResponse(t1 TopicReaderPartitionReadStartResponseStartInfo) func(TopicReaderPartitionReadStartResponseDoneInfo) {
   739  	fn := t.OnReaderPartitionReadStartResponse
   740  	if fn == nil {
   741  		return func(TopicReaderPartitionReadStartResponseDoneInfo) {
   742  			return
   743  		}
   744  	}
   745  	res := fn(t1)
   746  	if res == nil {
   747  		return func(TopicReaderPartitionReadStartResponseDoneInfo) {
   748  			return
   749  		}
   750  	}
   751  	return res
   752  }
   753  func (t *Topic) onReaderPartitionReadStopResponse(t1 TopicReaderPartitionReadStopResponseStartInfo) func(TopicReaderPartitionReadStopResponseDoneInfo) {
   754  	fn := t.OnReaderPartitionReadStopResponse
   755  	if fn == nil {
   756  		return func(TopicReaderPartitionReadStopResponseDoneInfo) {
   757  			return
   758  		}
   759  	}
   760  	res := fn(t1)
   761  	if res == nil {
   762  		return func(TopicReaderPartitionReadStopResponseDoneInfo) {
   763  			return
   764  		}
   765  	}
   766  	return res
   767  }
   768  func (t *Topic) onReaderCommit(t1 TopicReaderCommitStartInfo) func(TopicReaderCommitDoneInfo) {
   769  	fn := t.OnReaderCommit
   770  	if fn == nil {
   771  		return func(TopicReaderCommitDoneInfo) {
   772  			return
   773  		}
   774  	}
   775  	res := fn(t1)
   776  	if res == nil {
   777  		return func(TopicReaderCommitDoneInfo) {
   778  			return
   779  		}
   780  	}
   781  	return res
   782  }
   783  func (t *Topic) onReaderSendCommitMessage(t1 TopicReaderSendCommitMessageStartInfo) func(TopicReaderSendCommitMessageDoneInfo) {
   784  	fn := t.OnReaderSendCommitMessage
   785  	if fn == nil {
   786  		return func(TopicReaderSendCommitMessageDoneInfo) {
   787  			return
   788  		}
   789  	}
   790  	res := fn(t1)
   791  	if res == nil {
   792  		return func(TopicReaderSendCommitMessageDoneInfo) {
   793  			return
   794  		}
   795  	}
   796  	return res
   797  }
   798  func (t *Topic) onReaderCommittedNotify(t1 TopicReaderCommittedNotifyInfo) {
   799  	fn := t.OnReaderCommittedNotify
   800  	if fn == nil {
   801  		return
   802  	}
   803  	fn(t1)
   804  }
   805  func (t *Topic) onReaderClose(t1 TopicReaderCloseStartInfo) func(TopicReaderCloseDoneInfo) {
   806  	fn := t.OnReaderClose
   807  	if fn == nil {
   808  		return func(TopicReaderCloseDoneInfo) {
   809  			return
   810  		}
   811  	}
   812  	res := fn(t1)
   813  	if res == nil {
   814  		return func(TopicReaderCloseDoneInfo) {
   815  			return
   816  		}
   817  	}
   818  	return res
   819  }
   820  func (t *Topic) onReaderInit(t1 TopicReaderInitStartInfo) func(TopicReaderInitDoneInfo) {
   821  	fn := t.OnReaderInit
   822  	if fn == nil {
   823  		return func(TopicReaderInitDoneInfo) {
   824  			return
   825  		}
   826  	}
   827  	res := fn(t1)
   828  	if res == nil {
   829  		return func(TopicReaderInitDoneInfo) {
   830  			return
   831  		}
   832  	}
   833  	return res
   834  }
   835  func (t *Topic) onReaderError(t1 TopicReaderErrorInfo) {
   836  	fn := t.OnReaderError
   837  	if fn == nil {
   838  		return
   839  	}
   840  	fn(t1)
   841  }
   842  func (t *Topic) onReaderUpdateToken(o OnReadUpdateTokenStartInfo) func(OnReadUpdateTokenMiddleTokenReceivedInfo) func(OnReadStreamUpdateTokenDoneInfo) {
   843  	fn := t.OnReaderUpdateToken
   844  	if fn == nil {
   845  		return func(OnReadUpdateTokenMiddleTokenReceivedInfo) func(OnReadStreamUpdateTokenDoneInfo) {
   846  			return func(OnReadStreamUpdateTokenDoneInfo) {
   847  				return
   848  			}
   849  		}
   850  	}
   851  	res := fn(o)
   852  	if res == nil {
   853  		return func(OnReadUpdateTokenMiddleTokenReceivedInfo) func(OnReadStreamUpdateTokenDoneInfo) {
   854  			return func(OnReadStreamUpdateTokenDoneInfo) {
   855  				return
   856  			}
   857  		}
   858  	}
   859  	return func(o OnReadUpdateTokenMiddleTokenReceivedInfo) func(OnReadStreamUpdateTokenDoneInfo) {
   860  		res := res(o)
   861  		if res == nil {
   862  			return func(OnReadStreamUpdateTokenDoneInfo) {
   863  				return
   864  			}
   865  		}
   866  		return res
   867  	}
   868  }
   869  func (t *Topic) onReaderSentDataRequest(t1 TopicReaderSentDataRequestInfo) {
   870  	fn := t.OnReaderSentDataRequest
   871  	if fn == nil {
   872  		return
   873  	}
   874  	fn(t1)
   875  }
   876  func (t *Topic) onReaderReceiveDataResponse(t1 TopicReaderReceiveDataResponseStartInfo) func(TopicReaderReceiveDataResponseDoneInfo) {
   877  	fn := t.OnReaderReceiveDataResponse
   878  	if fn == nil {
   879  		return func(TopicReaderReceiveDataResponseDoneInfo) {
   880  			return
   881  		}
   882  	}
   883  	res := fn(t1)
   884  	if res == nil {
   885  		return func(TopicReaderReceiveDataResponseDoneInfo) {
   886  			return
   887  		}
   888  	}
   889  	return res
   890  }
   891  func (t *Topic) onReaderReadMessages(t1 TopicReaderReadMessagesStartInfo) func(TopicReaderReadMessagesDoneInfo) {
   892  	fn := t.OnReaderReadMessages
   893  	if fn == nil {
   894  		return func(TopicReaderReadMessagesDoneInfo) {
   895  			return
   896  		}
   897  	}
   898  	res := fn(t1)
   899  	if res == nil {
   900  		return func(TopicReaderReadMessagesDoneInfo) {
   901  			return
   902  		}
   903  	}
   904  	return res
   905  }
   906  func (t *Topic) onReaderUnknownGrpcMessage(o OnReadUnknownGrpcMessageInfo) {
   907  	fn := t.OnReaderUnknownGrpcMessage
   908  	if fn == nil {
   909  		return
   910  	}
   911  	fn(o)
   912  }
   913  func (t *Topic) onWriterReconnect(t1 TopicWriterReconnectStartInfo) func(TopicWriterReconnectDoneInfo) {
   914  	fn := t.OnWriterReconnect
   915  	if fn == nil {
   916  		return func(TopicWriterReconnectDoneInfo) {
   917  			return
   918  		}
   919  	}
   920  	res := fn(t1)
   921  	if res == nil {
   922  		return func(TopicWriterReconnectDoneInfo) {
   923  			return
   924  		}
   925  	}
   926  	return res
   927  }
   928  func (t *Topic) onWriterInitStream(t1 TopicWriterInitStreamStartInfo) func(TopicWriterInitStreamDoneInfo) {
   929  	fn := t.OnWriterInitStream
   930  	if fn == nil {
   931  		return func(TopicWriterInitStreamDoneInfo) {
   932  			return
   933  		}
   934  	}
   935  	res := fn(t1)
   936  	if res == nil {
   937  		return func(TopicWriterInitStreamDoneInfo) {
   938  			return
   939  		}
   940  	}
   941  	return res
   942  }
   943  func (t *Topic) onWriterClose(t1 TopicWriterCloseStartInfo) func(TopicWriterCloseDoneInfo) {
   944  	fn := t.OnWriterClose
   945  	if fn == nil {
   946  		return func(TopicWriterCloseDoneInfo) {
   947  			return
   948  		}
   949  	}
   950  	res := fn(t1)
   951  	if res == nil {
   952  		return func(TopicWriterCloseDoneInfo) {
   953  			return
   954  		}
   955  	}
   956  	return res
   957  }
   958  func (t *Topic) onWriterCompressMessages(t1 TopicWriterCompressMessagesStartInfo) func(TopicWriterCompressMessagesDoneInfo) {
   959  	fn := t.OnWriterCompressMessages
   960  	if fn == nil {
   961  		return func(TopicWriterCompressMessagesDoneInfo) {
   962  			return
   963  		}
   964  	}
   965  	res := fn(t1)
   966  	if res == nil {
   967  		return func(TopicWriterCompressMessagesDoneInfo) {
   968  			return
   969  		}
   970  	}
   971  	return res
   972  }
   973  func (t *Topic) onWriterSendMessages(t1 TopicWriterSendMessagesStartInfo) func(TopicWriterSendMessagesDoneInfo) {
   974  	fn := t.OnWriterSendMessages
   975  	if fn == nil {
   976  		return func(TopicWriterSendMessagesDoneInfo) {
   977  			return
   978  		}
   979  	}
   980  	res := fn(t1)
   981  	if res == nil {
   982  		return func(TopicWriterSendMessagesDoneInfo) {
   983  			return
   984  		}
   985  	}
   986  	return res
   987  }
   988  func (t *Topic) onWriterReadUnknownGrpcMessage(t1 TopicOnWriterReadUnknownGrpcMessageInfo) {
   989  	fn := t.OnWriterReadUnknownGrpcMessage
   990  	if fn == nil {
   991  		return
   992  	}
   993  	fn(t1)
   994  }
   995  func TopicOnReaderStart(t *Topic, readerID int64, consumer string) {
   996  	var p TopicReaderStartInfo
   997  	p.ReaderID = readerID
   998  	p.Consumer = consumer
   999  	t.onReaderStart(p)
  1000  }
  1001  func TopicOnReaderReconnect(t *Topic, reason error) func(error) {
  1002  	var p TopicReaderReconnectStartInfo
  1003  	p.Reason = reason
  1004  	res := t.onReaderReconnect(p)
  1005  	return func(e error) {
  1006  		var p TopicReaderReconnectDoneInfo
  1007  		p.Error = e
  1008  		res(p)
  1009  	}
  1010  }
  1011  func TopicOnReaderReconnectRequest(t *Topic, reason error, wasSent bool) {
  1012  	var p TopicReaderReconnectRequestInfo
  1013  	p.Reason = reason
  1014  	p.WasSent = wasSent
  1015  	t.onReaderReconnectRequest(p)
  1016  }
  1017  func TopicOnReaderPartitionReadStartResponse(t *Topic, readerConnectionID string, partitionContext context.Context, topic string, partitionID int64, partitionSessionID int64) func(readOffset *int64, commitOffset *int64, _ error) {
  1018  	var p TopicReaderPartitionReadStartResponseStartInfo
  1019  	p.ReaderConnectionID = readerConnectionID
  1020  	p.PartitionContext = partitionContext
  1021  	p.Topic = topic
  1022  	p.PartitionID = partitionID
  1023  	p.PartitionSessionID = partitionSessionID
  1024  	res := t.onReaderPartitionReadStartResponse(p)
  1025  	return func(readOffset *int64, commitOffset *int64, e error) {
  1026  		var p TopicReaderPartitionReadStartResponseDoneInfo
  1027  		p.ReadOffset = readOffset
  1028  		p.CommitOffset = commitOffset
  1029  		p.Error = e
  1030  		res(p)
  1031  	}
  1032  }
  1033  func TopicOnReaderPartitionReadStopResponse(t *Topic, readerConnectionID string, partitionContext context.Context, topic string, partitionID int64, partitionSessionID int64, committedOffset int64, graceful bool) func(error) {
  1034  	var p TopicReaderPartitionReadStopResponseStartInfo
  1035  	p.ReaderConnectionID = readerConnectionID
  1036  	p.PartitionContext = partitionContext
  1037  	p.Topic = topic
  1038  	p.PartitionID = partitionID
  1039  	p.PartitionSessionID = partitionSessionID
  1040  	p.CommittedOffset = committedOffset
  1041  	p.Graceful = graceful
  1042  	res := t.onReaderPartitionReadStopResponse(p)
  1043  	return func(e error) {
  1044  		var p TopicReaderPartitionReadStopResponseDoneInfo
  1045  		p.Error = e
  1046  		res(p)
  1047  	}
  1048  }
  1049  func TopicOnReaderCommit(t *Topic, requestContext context.Context, topic string, partitionID int64, partitionSessionID int64, startOffset int64, endOffset int64) func(error) {
  1050  	var p TopicReaderCommitStartInfo
  1051  	p.RequestContext = requestContext
  1052  	p.Topic = topic
  1053  	p.PartitionID = partitionID
  1054  	p.PartitionSessionID = partitionSessionID
  1055  	p.StartOffset = startOffset
  1056  	p.EndOffset = endOffset
  1057  	res := t.onReaderCommit(p)
  1058  	return func(e error) {
  1059  		var p TopicReaderCommitDoneInfo
  1060  		p.Error = e
  1061  		res(p)
  1062  	}
  1063  }
  1064  func TopicOnReaderSendCommitMessage(t *Topic, commitsInfo TopicReaderStreamSendCommitMessageStartMessageInfo) func(error) {
  1065  	var p TopicReaderSendCommitMessageStartInfo
  1066  	p.CommitsInfo = commitsInfo
  1067  	res := t.onReaderSendCommitMessage(p)
  1068  	return func(e error) {
  1069  		var p TopicReaderSendCommitMessageDoneInfo
  1070  		p.Error = e
  1071  		res(p)
  1072  	}
  1073  }
  1074  func TopicOnReaderCommittedNotify(t *Topic, readerConnectionID string, topic string, partitionID int64, partitionSessionID int64, committedOffset int64) {
  1075  	var p TopicReaderCommittedNotifyInfo
  1076  	p.ReaderConnectionID = readerConnectionID
  1077  	p.Topic = topic
  1078  	p.PartitionID = partitionID
  1079  	p.PartitionSessionID = partitionSessionID
  1080  	p.CommittedOffset = committedOffset
  1081  	t.onReaderCommittedNotify(p)
  1082  }
  1083  func TopicOnReaderClose(t *Topic, readerConnectionID string, closeReason error) func(closeError error) {
  1084  	var p TopicReaderCloseStartInfo
  1085  	p.ReaderConnectionID = readerConnectionID
  1086  	p.CloseReason = closeReason
  1087  	res := t.onReaderClose(p)
  1088  	return func(closeError error) {
  1089  		var p TopicReaderCloseDoneInfo
  1090  		p.CloseError = closeError
  1091  		res(p)
  1092  	}
  1093  }
  1094  func TopicOnReaderInit(t *Topic, preInitReaderConnectionID string, initRequestInfo TopicReadStreamInitRequestInfo) func(readerConnectionID string, _ error) {
  1095  	var p TopicReaderInitStartInfo
  1096  	p.PreInitReaderConnectionID = preInitReaderConnectionID
  1097  	p.InitRequestInfo = initRequestInfo
  1098  	res := t.onReaderInit(p)
  1099  	return func(readerConnectionID string, e error) {
  1100  		var p TopicReaderInitDoneInfo
  1101  		p.ReaderConnectionID = readerConnectionID
  1102  		p.Error = e
  1103  		res(p)
  1104  	}
  1105  }
  1106  func TopicOnReaderError(t *Topic, readerConnectionID string, e error) {
  1107  	var p TopicReaderErrorInfo
  1108  	p.ReaderConnectionID = readerConnectionID
  1109  	p.Error = e
  1110  	t.onReaderError(p)
  1111  }
  1112  func TopicOnReaderUpdateToken(t *Topic, readerConnectionID string) func(tokenLen int, _ error) func(error) {
  1113  	var p OnReadUpdateTokenStartInfo
  1114  	p.ReaderConnectionID = readerConnectionID
  1115  	res := t.onReaderUpdateToken(p)
  1116  	return func(tokenLen int, e error) func(error) {
  1117  		var p OnReadUpdateTokenMiddleTokenReceivedInfo
  1118  		p.TokenLen = tokenLen
  1119  		p.Error = e
  1120  		res := res(p)
  1121  		return func(e error) {
  1122  			var p OnReadStreamUpdateTokenDoneInfo
  1123  			p.Error = e
  1124  			res(p)
  1125  		}
  1126  	}
  1127  }
  1128  func TopicOnReaderSentDataRequest(t *Topic, readerConnectionID string, requestBytes int, localBufferSizeAfterSent int) {
  1129  	var p TopicReaderSentDataRequestInfo
  1130  	p.ReaderConnectionID = readerConnectionID
  1131  	p.RequestBytes = requestBytes
  1132  	p.LocalBufferSizeAfterSent = localBufferSizeAfterSent
  1133  	t.onReaderSentDataRequest(p)
  1134  }
  1135  func TopicOnReaderReceiveDataResponse(t *Topic, readerConnectionID string, localBufferSizeAfterReceive int, dataResponse TopicReaderDataResponseInfo) func(error) {
  1136  	var p TopicReaderReceiveDataResponseStartInfo
  1137  	p.ReaderConnectionID = readerConnectionID
  1138  	p.LocalBufferSizeAfterReceive = localBufferSizeAfterReceive
  1139  	p.DataResponse = dataResponse
  1140  	res := t.onReaderReceiveDataResponse(p)
  1141  	return func(e error) {
  1142  		var p TopicReaderReceiveDataResponseDoneInfo
  1143  		p.Error = e
  1144  		res(p)
  1145  	}
  1146  }
  1147  func TopicOnReaderReadMessages(t *Topic, requestContext context.Context, minCount int, maxCount int, freeBufferCapacity int) func(messagesCount int, topic string, partitionID int64, partitionSessionID int64, offsetStart int64, offsetEnd int64, freeBufferCapacity int, _ error) {
  1148  	var p TopicReaderReadMessagesStartInfo
  1149  	p.RequestContext = requestContext
  1150  	p.MinCount = minCount
  1151  	p.MaxCount = maxCount
  1152  	p.FreeBufferCapacity = freeBufferCapacity
  1153  	res := t.onReaderReadMessages(p)
  1154  	return func(messagesCount int, topic string, partitionID int64, partitionSessionID int64, offsetStart int64, offsetEnd int64, freeBufferCapacity int, e error) {
  1155  		var p TopicReaderReadMessagesDoneInfo
  1156  		p.MessagesCount = messagesCount
  1157  		p.Topic = topic
  1158  		p.PartitionID = partitionID
  1159  		p.PartitionSessionID = partitionSessionID
  1160  		p.OffsetStart = offsetStart
  1161  		p.OffsetEnd = offsetEnd
  1162  		p.FreeBufferCapacity = freeBufferCapacity
  1163  		p.Error = e
  1164  		res(p)
  1165  	}
  1166  }
  1167  func TopicOnReaderUnknownGrpcMessage(t *Topic, readerConnectionID string, e error) {
  1168  	var p OnReadUnknownGrpcMessageInfo
  1169  	p.ReaderConnectionID = readerConnectionID
  1170  	p.Error = e
  1171  	t.onReaderUnknownGrpcMessage(p)
  1172  }
  1173  func TopicOnWriterReconnect(t *Topic, writerInstanceID string, topic string, producerID string, attempt int) func(error) {
  1174  	var p TopicWriterReconnectStartInfo
  1175  	p.WriterInstanceID = writerInstanceID
  1176  	p.Topic = topic
  1177  	p.ProducerID = producerID
  1178  	p.Attempt = attempt
  1179  	res := t.onWriterReconnect(p)
  1180  	return func(e error) {
  1181  		var p TopicWriterReconnectDoneInfo
  1182  		p.Error = e
  1183  		res(p)
  1184  	}
  1185  }
  1186  func TopicOnWriterInitStream(t *Topic, writerInstanceID string, topic string, producerID string) func(sessionID string, _ error) {
  1187  	var p TopicWriterInitStreamStartInfo
  1188  	p.WriterInstanceID = writerInstanceID
  1189  	p.Topic = topic
  1190  	p.ProducerID = producerID
  1191  	res := t.onWriterInitStream(p)
  1192  	return func(sessionID string, e error) {
  1193  		var p TopicWriterInitStreamDoneInfo
  1194  		p.SessionID = sessionID
  1195  		p.Error = e
  1196  		res(p)
  1197  	}
  1198  }
  1199  func TopicOnWriterClose(t *Topic, writerInstanceID string, reason error) func(error) {
  1200  	var p TopicWriterCloseStartInfo
  1201  	p.WriterInstanceID = writerInstanceID
  1202  	p.Reason = reason
  1203  	res := t.onWriterClose(p)
  1204  	return func(e error) {
  1205  		var p TopicWriterCloseDoneInfo
  1206  		p.Error = e
  1207  		res(p)
  1208  	}
  1209  }
  1210  func TopicOnWriterCompressMessages(t *Topic, writerInstanceID string, sessionID string, codec int32, firstSeqNo int64, messagesCount int, reason TopicWriterCompressMessagesReason) func(error) {
  1211  	var p TopicWriterCompressMessagesStartInfo
  1212  	p.WriterInstanceID = writerInstanceID
  1213  	p.SessionID = sessionID
  1214  	p.Codec = codec
  1215  	p.FirstSeqNo = firstSeqNo
  1216  	p.MessagesCount = messagesCount
  1217  	p.Reason = reason
  1218  	res := t.onWriterCompressMessages(p)
  1219  	return func(e error) {
  1220  		var p TopicWriterCompressMessagesDoneInfo
  1221  		p.Error = e
  1222  		res(p)
  1223  	}
  1224  }
  1225  func TopicOnWriterSendMessages(t *Topic, writerInstanceID string, sessionID string, codec int32, firstSeqNo int64, messagesCount int) func(error) {
  1226  	var p TopicWriterSendMessagesStartInfo
  1227  	p.WriterInstanceID = writerInstanceID
  1228  	p.SessionID = sessionID
  1229  	p.Codec = codec
  1230  	p.FirstSeqNo = firstSeqNo
  1231  	p.MessagesCount = messagesCount
  1232  	res := t.onWriterSendMessages(p)
  1233  	return func(e error) {
  1234  		var p TopicWriterSendMessagesDoneInfo
  1235  		p.Error = e
  1236  		res(p)
  1237  	}
  1238  }
  1239  func TopicOnWriterReadUnknownGrpcMessage(t *Topic, writerInstanceID string, sessionID string, e error) {
  1240  	var p TopicOnWriterReadUnknownGrpcMessageInfo
  1241  	p.WriterInstanceID = writerInstanceID
  1242  	p.SessionID = sessionID
  1243  	p.Error = e
  1244  	t.onWriterReadUnknownGrpcMessage(p)
  1245  }