github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/trace/topic.go (about) 1 package trace 2 3 import ( 4 "context" 5 ) 6 7 // tool gtrace used from ./internal/cmd/gtrace 8 9 //go:generate gtrace 10 11 type ( 12 // Topic specified trace of topic reader client activity. 13 // gtrace:gen 14 Topic struct { 15 // TopicReaderCustomerEvents - upper level, on bridge with customer code 16 17 OnReaderStart func(info TopicReaderStartInfo) 18 19 // TopicReaderStreamLifeCycleEvents 20 21 OnReaderReconnect func(TopicReaderReconnectStartInfo) func(TopicReaderReconnectDoneInfo) 22 OnReaderReconnectRequest func(TopicReaderReconnectRequestInfo) 23 24 // TopicReaderPartitionEvents 25 26 OnReaderPartitionReadStartResponse func( 27 TopicReaderPartitionReadStartResponseStartInfo, 28 ) func( 29 TopicReaderPartitionReadStartResponseDoneInfo, 30 ) 31 OnReaderPartitionReadStopResponse func( 32 TopicReaderPartitionReadStopResponseStartInfo, 33 ) func( 34 TopicReaderPartitionReadStopResponseDoneInfo, 35 ) 36 37 // TopicReaderStreamEvents 38 39 OnReaderCommit func(TopicReaderCommitStartInfo) func(TopicReaderCommitDoneInfo) 40 OnReaderSendCommitMessage func(TopicReaderSendCommitMessageStartInfo) func(TopicReaderSendCommitMessageDoneInfo) 41 OnReaderCommittedNotify func(TopicReaderCommittedNotifyInfo) 42 OnReaderClose func(TopicReaderCloseStartInfo) func(TopicReaderCloseDoneInfo) 43 OnReaderInit func(TopicReaderInitStartInfo) func(TopicReaderInitDoneInfo) 44 OnReaderError func(TopicReaderErrorInfo) 45 OnReaderUpdateToken func( 46 OnReadUpdateTokenStartInfo, 47 ) func( 48 OnReadUpdateTokenMiddleTokenReceivedInfo, 49 ) func( 50 OnReadStreamUpdateTokenDoneInfo, 51 ) 52 53 // TopicReaderMessageEvents 54 55 OnReaderSentDataRequest func(TopicReaderSentDataRequestInfo) 56 OnReaderReceiveDataResponse func(TopicReaderReceiveDataResponseStartInfo) func(TopicReaderReceiveDataResponseDoneInfo) 57 OnReaderReadMessages func(TopicReaderReadMessagesStartInfo) func(TopicReaderReadMessagesDoneInfo) 58 OnReaderUnknownGrpcMessage func(OnReadUnknownGrpcMessageInfo) 59 60 // TopicWriterStreamLifeCycleEvents 61 62 OnWriterReconnect func(TopicWriterReconnectStartInfo) func(TopicWriterReconnectDoneInfo) 63 OnWriterInitStream func(TopicWriterInitStreamStartInfo) func(TopicWriterInitStreamDoneInfo) 64 OnWriterClose func(TopicWriterCloseStartInfo) func(TopicWriterCloseDoneInfo) 65 66 // TopicWriterStreamEvents 67 68 OnWriterCompressMessages func(TopicWriterCompressMessagesStartInfo) func(TopicWriterCompressMessagesDoneInfo) 69 OnWriterSendMessages func(TopicWriterSendMessagesStartInfo) func(TopicWriterSendMessagesDoneInfo) 70 OnWriterReadUnknownGrpcMessage func(TopicOnWriterReadUnknownGrpcMessageInfo) 71 } 72 73 TopicReaderPartitionReadStartResponseStartInfo struct { 74 ReaderConnectionID string 75 PartitionContext context.Context 76 Topic string 77 PartitionID int64 78 PartitionSessionID int64 79 } 80 81 TopicReaderStartInfo struct { 82 ReaderID int64 83 Consumer string 84 } 85 86 TopicReaderPartitionReadStartResponseDoneInfo struct { 87 ReadOffset *int64 88 CommitOffset *int64 89 Error error 90 } 91 92 TopicReaderPartitionReadStopResponseStartInfo struct { 93 ReaderConnectionID string 94 PartitionContext context.Context 95 Topic string 96 PartitionID int64 97 PartitionSessionID int64 98 CommittedOffset int64 99 Graceful bool 100 } 101 102 TopicReaderPartitionReadStopResponseDoneInfo struct { 103 Error error 104 } 105 106 TopicReaderSendCommitMessageStartInfo struct { 107 CommitsInfo TopicReaderStreamSendCommitMessageStartMessageInfo 108 } 109 110 TopicReaderStreamCommitInfo struct { 111 Topic string 112 PartitionID int64 113 PartitionSessionID int64 114 StartOffset int64 115 EndOffset int64 116 } 117 118 TopicReaderStreamSendCommitMessageStartMessageInfo interface { 119 GetCommitsInfo() []TopicReaderStreamCommitInfo 120 } 121 122 TopicReaderSendCommitMessageDoneInfo struct { 123 Error error 124 } 125 126 TopicReaderCommittedNotifyInfo struct { 127 ReaderConnectionID string 128 Topic string 129 PartitionID int64 130 PartitionSessionID int64 131 CommittedOffset int64 132 } 133 134 TopicReaderErrorInfo struct { 135 ReaderConnectionID string 136 Error error 137 } 138 139 TopicReaderSentDataRequestInfo struct { 140 ReaderConnectionID string 141 RequestBytes int 142 LocalBufferSizeAfterSent int 143 } 144 145 TopicReaderReceiveDataResponseStartInfo struct { 146 ReaderConnectionID string 147 LocalBufferSizeAfterReceive int 148 DataResponse TopicReaderDataResponseInfo 149 } 150 151 TopicReaderDataResponseInfo interface { 152 GetBytesSize() int 153 GetPartitionBatchMessagesCounts() (partitionCount, batchCount, messagesCount int) 154 } 155 156 TopicReaderReceiveDataResponseDoneInfo struct { 157 Error error 158 } 159 160 TopicReaderReadMessagesStartInfo struct { 161 RequestContext context.Context 162 MinCount int 163 MaxCount int 164 FreeBufferCapacity int 165 } 166 167 TopicReaderReadMessagesDoneInfo struct { 168 MessagesCount int 169 Topic string 170 PartitionID int64 171 PartitionSessionID int64 172 OffsetStart int64 173 OffsetEnd int64 174 FreeBufferCapacity int 175 Error error 176 } 177 178 OnReadUnknownGrpcMessageInfo struct { 179 ReaderConnectionID string 180 Error error 181 } 182 183 TopicReaderReconnectStartInfo struct { 184 Reason error 185 } 186 187 TopicReaderReconnectDoneInfo struct { 188 Error error 189 } 190 191 TopicReaderReconnectRequestInfo struct { 192 Reason error 193 WasSent bool 194 } 195 196 TopicReaderCommitStartInfo struct { 197 RequestContext context.Context 198 Topic string 199 PartitionID int64 200 PartitionSessionID int64 201 StartOffset int64 202 EndOffset int64 203 } 204 205 TopicReaderCommitDoneInfo struct { 206 Error error 207 } 208 209 TopicReaderCloseStartInfo struct { 210 ReaderConnectionID string 211 CloseReason error 212 } 213 214 TopicReaderCloseDoneInfo struct { 215 CloseError error 216 } 217 218 TopicReaderInitStartInfo struct { 219 PreInitReaderConnectionID string 220 InitRequestInfo TopicReadStreamInitRequestInfo 221 } 222 223 TopicReadStreamInitRequestInfo interface { 224 GetConsumer() string 225 GetTopics() []string 226 } 227 228 TopicReaderInitDoneInfo struct { 229 ReaderConnectionID string 230 Error error 231 } 232 233 OnReadUpdateTokenStartInfo struct { 234 ReaderConnectionID string 235 } 236 237 OnReadUpdateTokenMiddleTokenReceivedInfo struct { 238 TokenLen int 239 Error error 240 } 241 242 OnReadStreamUpdateTokenDoneInfo struct { 243 Error error 244 } 245 246 //////////// 247 //////////// TopicWriter 248 //////////// 249 250 TopicWriterReconnectStartInfo struct { 251 WriterInstanceID string 252 Topic string 253 ProducerID string 254 Attempt int 255 } 256 257 TopicWriterReconnectDoneInfo struct { 258 Error error 259 } 260 261 TopicWriterInitStreamStartInfo struct { 262 WriterInstanceID string 263 Topic string 264 ProducerID string 265 } 266 267 TopicWriterInitStreamDoneInfo struct { 268 SessionID string 269 Error error 270 } 271 272 TopicWriterCloseStartInfo struct { 273 WriterInstanceID string 274 Reason error 275 } 276 277 TopicWriterCloseDoneInfo struct { 278 Error error 279 } 280 281 TopicWriterCompressMessagesStartInfo struct { 282 WriterInstanceID string 283 SessionID string 284 Codec int32 285 FirstSeqNo int64 286 MessagesCount int 287 Reason TopicWriterCompressMessagesReason 288 } 289 290 TopicWriterCompressMessagesDoneInfo struct { 291 Error error 292 } 293 294 TopicWriterSendMessagesStartInfo struct { 295 WriterInstanceID string 296 SessionID string 297 Codec int32 298 FirstSeqNo int64 299 MessagesCount int 300 } 301 302 TopicWriterSendMessagesDoneInfo struct { 303 Error error 304 } 305 306 TopicOnWriterReadUnknownGrpcMessageInfo struct { 307 WriterInstanceID string 308 SessionID string 309 Error error 310 } 311 ) 312 313 type TopicWriterCompressMessagesReason string 314 315 const ( 316 TopicWriterCompressMessagesReasonCompressData = TopicWriterCompressMessagesReason("compress-on-send") //nolint:lll 317 TopicWriterCompressMessagesReasonCompressDataOnWriteReadData = TopicWriterCompressMessagesReason("compress-on-call-write") //nolint:lll 318 TopicWriterCompressMessagesReasonCodecsMeasure = TopicWriterCompressMessagesReason("compress-on-codecs-measure") //nolint:lll 319 ) 320 321 func (r TopicWriterCompressMessagesReason) String() string { 322 return string(r) 323 }