github.com/lirm/aeron-go@v0.0.0-20230415210743-920325491dc4/archive/codecs/BoundedReplayRequest.go (about) 1 // Generated SBE (Simple Binary Encoding) message codec 2 3 package codecs 4 5 import ( 6 "fmt" 7 "io" 8 "io/ioutil" 9 "math" 10 ) 11 12 type BoundedReplayRequest struct { 13 ControlSessionId int64 14 CorrelationId int64 15 RecordingId int64 16 Position int64 17 Length int64 18 LimitCounterId int32 19 ReplayStreamId int32 20 ReplayChannel []uint8 21 } 22 23 func (b *BoundedReplayRequest) Encode(_m *SbeGoMarshaller, _w io.Writer, doRangeCheck bool) error { 24 if doRangeCheck { 25 if err := b.RangeCheck(b.SbeSchemaVersion(), b.SbeSchemaVersion()); err != nil { 26 return err 27 } 28 } 29 if err := _m.WriteInt64(_w, b.ControlSessionId); err != nil { 30 return err 31 } 32 if err := _m.WriteInt64(_w, b.CorrelationId); err != nil { 33 return err 34 } 35 if err := _m.WriteInt64(_w, b.RecordingId); err != nil { 36 return err 37 } 38 if err := _m.WriteInt64(_w, b.Position); err != nil { 39 return err 40 } 41 if err := _m.WriteInt64(_w, b.Length); err != nil { 42 return err 43 } 44 if err := _m.WriteInt32(_w, b.LimitCounterId); err != nil { 45 return err 46 } 47 if err := _m.WriteInt32(_w, b.ReplayStreamId); err != nil { 48 return err 49 } 50 if err := _m.WriteUint32(_w, uint32(len(b.ReplayChannel))); err != nil { 51 return err 52 } 53 if err := _m.WriteBytes(_w, b.ReplayChannel); err != nil { 54 return err 55 } 56 return nil 57 } 58 59 func (b *BoundedReplayRequest) Decode(_m *SbeGoMarshaller, _r io.Reader, actingVersion uint16, blockLength uint16, doRangeCheck bool) error { 60 if !b.ControlSessionIdInActingVersion(actingVersion) { 61 b.ControlSessionId = b.ControlSessionIdNullValue() 62 } else { 63 if err := _m.ReadInt64(_r, &b.ControlSessionId); err != nil { 64 return err 65 } 66 } 67 if !b.CorrelationIdInActingVersion(actingVersion) { 68 b.CorrelationId = b.CorrelationIdNullValue() 69 } else { 70 if err := _m.ReadInt64(_r, &b.CorrelationId); err != nil { 71 return err 72 } 73 } 74 if !b.RecordingIdInActingVersion(actingVersion) { 75 b.RecordingId = b.RecordingIdNullValue() 76 } else { 77 if err := _m.ReadInt64(_r, &b.RecordingId); err != nil { 78 return err 79 } 80 } 81 if !b.PositionInActingVersion(actingVersion) { 82 b.Position = b.PositionNullValue() 83 } else { 84 if err := _m.ReadInt64(_r, &b.Position); err != nil { 85 return err 86 } 87 } 88 if !b.LengthInActingVersion(actingVersion) { 89 b.Length = b.LengthNullValue() 90 } else { 91 if err := _m.ReadInt64(_r, &b.Length); err != nil { 92 return err 93 } 94 } 95 if !b.LimitCounterIdInActingVersion(actingVersion) { 96 b.LimitCounterId = b.LimitCounterIdNullValue() 97 } else { 98 if err := _m.ReadInt32(_r, &b.LimitCounterId); err != nil { 99 return err 100 } 101 } 102 if !b.ReplayStreamIdInActingVersion(actingVersion) { 103 b.ReplayStreamId = b.ReplayStreamIdNullValue() 104 } else { 105 if err := _m.ReadInt32(_r, &b.ReplayStreamId); err != nil { 106 return err 107 } 108 } 109 if actingVersion > b.SbeSchemaVersion() && blockLength > b.SbeBlockLength() { 110 io.CopyN(ioutil.Discard, _r, int64(blockLength-b.SbeBlockLength())) 111 } 112 113 if b.ReplayChannelInActingVersion(actingVersion) { 114 var ReplayChannelLength uint32 115 if err := _m.ReadUint32(_r, &ReplayChannelLength); err != nil { 116 return err 117 } 118 if cap(b.ReplayChannel) < int(ReplayChannelLength) { 119 b.ReplayChannel = make([]uint8, ReplayChannelLength) 120 } 121 b.ReplayChannel = b.ReplayChannel[:ReplayChannelLength] 122 if err := _m.ReadBytes(_r, b.ReplayChannel); err != nil { 123 return err 124 } 125 } 126 if doRangeCheck { 127 if err := b.RangeCheck(actingVersion, b.SbeSchemaVersion()); err != nil { 128 return err 129 } 130 } 131 return nil 132 } 133 134 func (b *BoundedReplayRequest) RangeCheck(actingVersion uint16, schemaVersion uint16) error { 135 if b.ControlSessionIdInActingVersion(actingVersion) { 136 if b.ControlSessionId < b.ControlSessionIdMinValue() || b.ControlSessionId > b.ControlSessionIdMaxValue() { 137 return fmt.Errorf("Range check failed on b.ControlSessionId (%v < %v > %v)", b.ControlSessionIdMinValue(), b.ControlSessionId, b.ControlSessionIdMaxValue()) 138 } 139 } 140 if b.CorrelationIdInActingVersion(actingVersion) { 141 if b.CorrelationId < b.CorrelationIdMinValue() || b.CorrelationId > b.CorrelationIdMaxValue() { 142 return fmt.Errorf("Range check failed on b.CorrelationId (%v < %v > %v)", b.CorrelationIdMinValue(), b.CorrelationId, b.CorrelationIdMaxValue()) 143 } 144 } 145 if b.RecordingIdInActingVersion(actingVersion) { 146 if b.RecordingId < b.RecordingIdMinValue() || b.RecordingId > b.RecordingIdMaxValue() { 147 return fmt.Errorf("Range check failed on b.RecordingId (%v < %v > %v)", b.RecordingIdMinValue(), b.RecordingId, b.RecordingIdMaxValue()) 148 } 149 } 150 if b.PositionInActingVersion(actingVersion) { 151 if b.Position < b.PositionMinValue() || b.Position > b.PositionMaxValue() { 152 return fmt.Errorf("Range check failed on b.Position (%v < %v > %v)", b.PositionMinValue(), b.Position, b.PositionMaxValue()) 153 } 154 } 155 if b.LengthInActingVersion(actingVersion) { 156 if b.Length < b.LengthMinValue() || b.Length > b.LengthMaxValue() { 157 return fmt.Errorf("Range check failed on b.Length (%v < %v > %v)", b.LengthMinValue(), b.Length, b.LengthMaxValue()) 158 } 159 } 160 if b.LimitCounterIdInActingVersion(actingVersion) { 161 if b.LimitCounterId < b.LimitCounterIdMinValue() || b.LimitCounterId > b.LimitCounterIdMaxValue() { 162 return fmt.Errorf("Range check failed on b.LimitCounterId (%v < %v > %v)", b.LimitCounterIdMinValue(), b.LimitCounterId, b.LimitCounterIdMaxValue()) 163 } 164 } 165 if b.ReplayStreamIdInActingVersion(actingVersion) { 166 if b.ReplayStreamId < b.ReplayStreamIdMinValue() || b.ReplayStreamId > b.ReplayStreamIdMaxValue() { 167 return fmt.Errorf("Range check failed on b.ReplayStreamId (%v < %v > %v)", b.ReplayStreamIdMinValue(), b.ReplayStreamId, b.ReplayStreamIdMaxValue()) 168 } 169 } 170 return nil 171 } 172 173 func BoundedReplayRequestInit(b *BoundedReplayRequest) { 174 return 175 } 176 177 func (*BoundedReplayRequest) SbeBlockLength() (blockLength uint16) { 178 return 48 179 } 180 181 func (*BoundedReplayRequest) SbeTemplateId() (templateId uint16) { 182 return 18 183 } 184 185 func (*BoundedReplayRequest) SbeSchemaId() (schemaId uint16) { 186 return 101 187 } 188 189 func (*BoundedReplayRequest) SbeSchemaVersion() (schemaVersion uint16) { 190 return 6 191 } 192 193 func (*BoundedReplayRequest) SbeSemanticType() (semanticType []byte) { 194 return []byte("") 195 } 196 197 func (*BoundedReplayRequest) ControlSessionIdId() uint16 { 198 return 1 199 } 200 201 func (*BoundedReplayRequest) ControlSessionIdSinceVersion() uint16 { 202 return 0 203 } 204 205 func (b *BoundedReplayRequest) ControlSessionIdInActingVersion(actingVersion uint16) bool { 206 return actingVersion >= b.ControlSessionIdSinceVersion() 207 } 208 209 func (*BoundedReplayRequest) ControlSessionIdDeprecated() uint16 { 210 return 0 211 } 212 213 func (*BoundedReplayRequest) ControlSessionIdMetaAttribute(meta int) string { 214 switch meta { 215 case 1: 216 return "" 217 case 2: 218 return "" 219 case 3: 220 return "" 221 case 4: 222 return "required" 223 } 224 return "" 225 } 226 227 func (*BoundedReplayRequest) ControlSessionIdMinValue() int64 { 228 return math.MinInt64 + 1 229 } 230 231 func (*BoundedReplayRequest) ControlSessionIdMaxValue() int64 { 232 return math.MaxInt64 233 } 234 235 func (*BoundedReplayRequest) ControlSessionIdNullValue() int64 { 236 return math.MinInt64 237 } 238 239 func (*BoundedReplayRequest) CorrelationIdId() uint16 { 240 return 2 241 } 242 243 func (*BoundedReplayRequest) CorrelationIdSinceVersion() uint16 { 244 return 0 245 } 246 247 func (b *BoundedReplayRequest) CorrelationIdInActingVersion(actingVersion uint16) bool { 248 return actingVersion >= b.CorrelationIdSinceVersion() 249 } 250 251 func (*BoundedReplayRequest) CorrelationIdDeprecated() uint16 { 252 return 0 253 } 254 255 func (*BoundedReplayRequest) CorrelationIdMetaAttribute(meta int) string { 256 switch meta { 257 case 1: 258 return "" 259 case 2: 260 return "" 261 case 3: 262 return "" 263 case 4: 264 return "required" 265 } 266 return "" 267 } 268 269 func (*BoundedReplayRequest) CorrelationIdMinValue() int64 { 270 return math.MinInt64 + 1 271 } 272 273 func (*BoundedReplayRequest) CorrelationIdMaxValue() int64 { 274 return math.MaxInt64 275 } 276 277 func (*BoundedReplayRequest) CorrelationIdNullValue() int64 { 278 return math.MinInt64 279 } 280 281 func (*BoundedReplayRequest) RecordingIdId() uint16 { 282 return 3 283 } 284 285 func (*BoundedReplayRequest) RecordingIdSinceVersion() uint16 { 286 return 0 287 } 288 289 func (b *BoundedReplayRequest) RecordingIdInActingVersion(actingVersion uint16) bool { 290 return actingVersion >= b.RecordingIdSinceVersion() 291 } 292 293 func (*BoundedReplayRequest) RecordingIdDeprecated() uint16 { 294 return 0 295 } 296 297 func (*BoundedReplayRequest) RecordingIdMetaAttribute(meta int) string { 298 switch meta { 299 case 1: 300 return "" 301 case 2: 302 return "" 303 case 3: 304 return "" 305 case 4: 306 return "required" 307 } 308 return "" 309 } 310 311 func (*BoundedReplayRequest) RecordingIdMinValue() int64 { 312 return math.MinInt64 + 1 313 } 314 315 func (*BoundedReplayRequest) RecordingIdMaxValue() int64 { 316 return math.MaxInt64 317 } 318 319 func (*BoundedReplayRequest) RecordingIdNullValue() int64 { 320 return math.MinInt64 321 } 322 323 func (*BoundedReplayRequest) PositionId() uint16 { 324 return 4 325 } 326 327 func (*BoundedReplayRequest) PositionSinceVersion() uint16 { 328 return 0 329 } 330 331 func (b *BoundedReplayRequest) PositionInActingVersion(actingVersion uint16) bool { 332 return actingVersion >= b.PositionSinceVersion() 333 } 334 335 func (*BoundedReplayRequest) PositionDeprecated() uint16 { 336 return 0 337 } 338 339 func (*BoundedReplayRequest) PositionMetaAttribute(meta int) string { 340 switch meta { 341 case 1: 342 return "" 343 case 2: 344 return "" 345 case 3: 346 return "" 347 case 4: 348 return "required" 349 } 350 return "" 351 } 352 353 func (*BoundedReplayRequest) PositionMinValue() int64 { 354 return math.MinInt64 + 1 355 } 356 357 func (*BoundedReplayRequest) PositionMaxValue() int64 { 358 return math.MaxInt64 359 } 360 361 func (*BoundedReplayRequest) PositionNullValue() int64 { 362 return math.MinInt64 363 } 364 365 func (*BoundedReplayRequest) LengthId() uint16 { 366 return 5 367 } 368 369 func (*BoundedReplayRequest) LengthSinceVersion() uint16 { 370 return 0 371 } 372 373 func (b *BoundedReplayRequest) LengthInActingVersion(actingVersion uint16) bool { 374 return actingVersion >= b.LengthSinceVersion() 375 } 376 377 func (*BoundedReplayRequest) LengthDeprecated() uint16 { 378 return 0 379 } 380 381 func (*BoundedReplayRequest) LengthMetaAttribute(meta int) string { 382 switch meta { 383 case 1: 384 return "" 385 case 2: 386 return "" 387 case 3: 388 return "" 389 case 4: 390 return "required" 391 } 392 return "" 393 } 394 395 func (*BoundedReplayRequest) LengthMinValue() int64 { 396 return math.MinInt64 + 1 397 } 398 399 func (*BoundedReplayRequest) LengthMaxValue() int64 { 400 return math.MaxInt64 401 } 402 403 func (*BoundedReplayRequest) LengthNullValue() int64 { 404 return math.MinInt64 405 } 406 407 func (*BoundedReplayRequest) LimitCounterIdId() uint16 { 408 return 6 409 } 410 411 func (*BoundedReplayRequest) LimitCounterIdSinceVersion() uint16 { 412 return 0 413 } 414 415 func (b *BoundedReplayRequest) LimitCounterIdInActingVersion(actingVersion uint16) bool { 416 return actingVersion >= b.LimitCounterIdSinceVersion() 417 } 418 419 func (*BoundedReplayRequest) LimitCounterIdDeprecated() uint16 { 420 return 0 421 } 422 423 func (*BoundedReplayRequest) LimitCounterIdMetaAttribute(meta int) string { 424 switch meta { 425 case 1: 426 return "" 427 case 2: 428 return "" 429 case 3: 430 return "" 431 case 4: 432 return "required" 433 } 434 return "" 435 } 436 437 func (*BoundedReplayRequest) LimitCounterIdMinValue() int32 { 438 return math.MinInt32 + 1 439 } 440 441 func (*BoundedReplayRequest) LimitCounterIdMaxValue() int32 { 442 return math.MaxInt32 443 } 444 445 func (*BoundedReplayRequest) LimitCounterIdNullValue() int32 { 446 return math.MinInt32 447 } 448 449 func (*BoundedReplayRequest) ReplayStreamIdId() uint16 { 450 return 7 451 } 452 453 func (*BoundedReplayRequest) ReplayStreamIdSinceVersion() uint16 { 454 return 0 455 } 456 457 func (b *BoundedReplayRequest) ReplayStreamIdInActingVersion(actingVersion uint16) bool { 458 return actingVersion >= b.ReplayStreamIdSinceVersion() 459 } 460 461 func (*BoundedReplayRequest) ReplayStreamIdDeprecated() uint16 { 462 return 0 463 } 464 465 func (*BoundedReplayRequest) ReplayStreamIdMetaAttribute(meta int) string { 466 switch meta { 467 case 1: 468 return "" 469 case 2: 470 return "" 471 case 3: 472 return "" 473 case 4: 474 return "required" 475 } 476 return "" 477 } 478 479 func (*BoundedReplayRequest) ReplayStreamIdMinValue() int32 { 480 return math.MinInt32 + 1 481 } 482 483 func (*BoundedReplayRequest) ReplayStreamIdMaxValue() int32 { 484 return math.MaxInt32 485 } 486 487 func (*BoundedReplayRequest) ReplayStreamIdNullValue() int32 { 488 return math.MinInt32 489 } 490 491 func (*BoundedReplayRequest) ReplayChannelMetaAttribute(meta int) string { 492 switch meta { 493 case 1: 494 return "" 495 case 2: 496 return "" 497 case 3: 498 return "" 499 case 4: 500 return "required" 501 } 502 return "" 503 } 504 505 func (*BoundedReplayRequest) ReplayChannelSinceVersion() uint16 { 506 return 0 507 } 508 509 func (b *BoundedReplayRequest) ReplayChannelInActingVersion(actingVersion uint16) bool { 510 return actingVersion >= b.ReplayChannelSinceVersion() 511 } 512 513 func (*BoundedReplayRequest) ReplayChannelDeprecated() uint16 { 514 return 0 515 } 516 517 func (BoundedReplayRequest) ReplayChannelCharacterEncoding() string { 518 return "US-ASCII" 519 } 520 521 func (BoundedReplayRequest) ReplayChannelHeaderLength() uint64 { 522 return 4 523 }