github.com/lirm/aeron-go@v0.0.0-20230415210743-920325491dc4/archive/codecs/DetachSegmentsRequest.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 DetachSegmentsRequest struct { 13 ControlSessionId int64 14 CorrelationId int64 15 RecordingId int64 16 NewStartPosition int64 17 } 18 19 func (d *DetachSegmentsRequest) Encode(_m *SbeGoMarshaller, _w io.Writer, doRangeCheck bool) error { 20 if doRangeCheck { 21 if err := d.RangeCheck(d.SbeSchemaVersion(), d.SbeSchemaVersion()); err != nil { 22 return err 23 } 24 } 25 if err := _m.WriteInt64(_w, d.ControlSessionId); err != nil { 26 return err 27 } 28 if err := _m.WriteInt64(_w, d.CorrelationId); err != nil { 29 return err 30 } 31 if err := _m.WriteInt64(_w, d.RecordingId); err != nil { 32 return err 33 } 34 if err := _m.WriteInt64(_w, d.NewStartPosition); err != nil { 35 return err 36 } 37 return nil 38 } 39 40 func (d *DetachSegmentsRequest) Decode(_m *SbeGoMarshaller, _r io.Reader, actingVersion uint16, blockLength uint16, doRangeCheck bool) error { 41 if !d.ControlSessionIdInActingVersion(actingVersion) { 42 d.ControlSessionId = d.ControlSessionIdNullValue() 43 } else { 44 if err := _m.ReadInt64(_r, &d.ControlSessionId); err != nil { 45 return err 46 } 47 } 48 if !d.CorrelationIdInActingVersion(actingVersion) { 49 d.CorrelationId = d.CorrelationIdNullValue() 50 } else { 51 if err := _m.ReadInt64(_r, &d.CorrelationId); err != nil { 52 return err 53 } 54 } 55 if !d.RecordingIdInActingVersion(actingVersion) { 56 d.RecordingId = d.RecordingIdNullValue() 57 } else { 58 if err := _m.ReadInt64(_r, &d.RecordingId); err != nil { 59 return err 60 } 61 } 62 if !d.NewStartPositionInActingVersion(actingVersion) { 63 d.NewStartPosition = d.NewStartPositionNullValue() 64 } else { 65 if err := _m.ReadInt64(_r, &d.NewStartPosition); err != nil { 66 return err 67 } 68 } 69 if actingVersion > d.SbeSchemaVersion() && blockLength > d.SbeBlockLength() { 70 io.CopyN(ioutil.Discard, _r, int64(blockLength-d.SbeBlockLength())) 71 } 72 if doRangeCheck { 73 if err := d.RangeCheck(actingVersion, d.SbeSchemaVersion()); err != nil { 74 return err 75 } 76 } 77 return nil 78 } 79 80 func (d *DetachSegmentsRequest) RangeCheck(actingVersion uint16, schemaVersion uint16) error { 81 if d.ControlSessionIdInActingVersion(actingVersion) { 82 if d.ControlSessionId < d.ControlSessionIdMinValue() || d.ControlSessionId > d.ControlSessionIdMaxValue() { 83 return fmt.Errorf("Range check failed on d.ControlSessionId (%v < %v > %v)", d.ControlSessionIdMinValue(), d.ControlSessionId, d.ControlSessionIdMaxValue()) 84 } 85 } 86 if d.CorrelationIdInActingVersion(actingVersion) { 87 if d.CorrelationId < d.CorrelationIdMinValue() || d.CorrelationId > d.CorrelationIdMaxValue() { 88 return fmt.Errorf("Range check failed on d.CorrelationId (%v < %v > %v)", d.CorrelationIdMinValue(), d.CorrelationId, d.CorrelationIdMaxValue()) 89 } 90 } 91 if d.RecordingIdInActingVersion(actingVersion) { 92 if d.RecordingId < d.RecordingIdMinValue() || d.RecordingId > d.RecordingIdMaxValue() { 93 return fmt.Errorf("Range check failed on d.RecordingId (%v < %v > %v)", d.RecordingIdMinValue(), d.RecordingId, d.RecordingIdMaxValue()) 94 } 95 } 96 if d.NewStartPositionInActingVersion(actingVersion) { 97 if d.NewStartPosition < d.NewStartPositionMinValue() || d.NewStartPosition > d.NewStartPositionMaxValue() { 98 return fmt.Errorf("Range check failed on d.NewStartPosition (%v < %v > %v)", d.NewStartPositionMinValue(), d.NewStartPosition, d.NewStartPositionMaxValue()) 99 } 100 } 101 return nil 102 } 103 104 func DetachSegmentsRequestInit(d *DetachSegmentsRequest) { 105 return 106 } 107 108 func (*DetachSegmentsRequest) SbeBlockLength() (blockLength uint16) { 109 return 32 110 } 111 112 func (*DetachSegmentsRequest) SbeTemplateId() (templateId uint16) { 113 return 53 114 } 115 116 func (*DetachSegmentsRequest) SbeSchemaId() (schemaId uint16) { 117 return 101 118 } 119 120 func (*DetachSegmentsRequest) SbeSchemaVersion() (schemaVersion uint16) { 121 return 6 122 } 123 124 func (*DetachSegmentsRequest) SbeSemanticType() (semanticType []byte) { 125 return []byte("") 126 } 127 128 func (*DetachSegmentsRequest) ControlSessionIdId() uint16 { 129 return 1 130 } 131 132 func (*DetachSegmentsRequest) ControlSessionIdSinceVersion() uint16 { 133 return 0 134 } 135 136 func (d *DetachSegmentsRequest) ControlSessionIdInActingVersion(actingVersion uint16) bool { 137 return actingVersion >= d.ControlSessionIdSinceVersion() 138 } 139 140 func (*DetachSegmentsRequest) ControlSessionIdDeprecated() uint16 { 141 return 0 142 } 143 144 func (*DetachSegmentsRequest) ControlSessionIdMetaAttribute(meta int) string { 145 switch meta { 146 case 1: 147 return "" 148 case 2: 149 return "" 150 case 3: 151 return "" 152 case 4: 153 return "required" 154 } 155 return "" 156 } 157 158 func (*DetachSegmentsRequest) ControlSessionIdMinValue() int64 { 159 return math.MinInt64 + 1 160 } 161 162 func (*DetachSegmentsRequest) ControlSessionIdMaxValue() int64 { 163 return math.MaxInt64 164 } 165 166 func (*DetachSegmentsRequest) ControlSessionIdNullValue() int64 { 167 return math.MinInt64 168 } 169 170 func (*DetachSegmentsRequest) CorrelationIdId() uint16 { 171 return 2 172 } 173 174 func (*DetachSegmentsRequest) CorrelationIdSinceVersion() uint16 { 175 return 0 176 } 177 178 func (d *DetachSegmentsRequest) CorrelationIdInActingVersion(actingVersion uint16) bool { 179 return actingVersion >= d.CorrelationIdSinceVersion() 180 } 181 182 func (*DetachSegmentsRequest) CorrelationIdDeprecated() uint16 { 183 return 0 184 } 185 186 func (*DetachSegmentsRequest) CorrelationIdMetaAttribute(meta int) string { 187 switch meta { 188 case 1: 189 return "" 190 case 2: 191 return "" 192 case 3: 193 return "" 194 case 4: 195 return "required" 196 } 197 return "" 198 } 199 200 func (*DetachSegmentsRequest) CorrelationIdMinValue() int64 { 201 return math.MinInt64 + 1 202 } 203 204 func (*DetachSegmentsRequest) CorrelationIdMaxValue() int64 { 205 return math.MaxInt64 206 } 207 208 func (*DetachSegmentsRequest) CorrelationIdNullValue() int64 { 209 return math.MinInt64 210 } 211 212 func (*DetachSegmentsRequest) RecordingIdId() uint16 { 213 return 3 214 } 215 216 func (*DetachSegmentsRequest) RecordingIdSinceVersion() uint16 { 217 return 0 218 } 219 220 func (d *DetachSegmentsRequest) RecordingIdInActingVersion(actingVersion uint16) bool { 221 return actingVersion >= d.RecordingIdSinceVersion() 222 } 223 224 func (*DetachSegmentsRequest) RecordingIdDeprecated() uint16 { 225 return 0 226 } 227 228 func (*DetachSegmentsRequest) RecordingIdMetaAttribute(meta int) string { 229 switch meta { 230 case 1: 231 return "" 232 case 2: 233 return "" 234 case 3: 235 return "" 236 case 4: 237 return "required" 238 } 239 return "" 240 } 241 242 func (*DetachSegmentsRequest) RecordingIdMinValue() int64 { 243 return math.MinInt64 + 1 244 } 245 246 func (*DetachSegmentsRequest) RecordingIdMaxValue() int64 { 247 return math.MaxInt64 248 } 249 250 func (*DetachSegmentsRequest) RecordingIdNullValue() int64 { 251 return math.MinInt64 252 } 253 254 func (*DetachSegmentsRequest) NewStartPositionId() uint16 { 255 return 4 256 } 257 258 func (*DetachSegmentsRequest) NewStartPositionSinceVersion() uint16 { 259 return 0 260 } 261 262 func (d *DetachSegmentsRequest) NewStartPositionInActingVersion(actingVersion uint16) bool { 263 return actingVersion >= d.NewStartPositionSinceVersion() 264 } 265 266 func (*DetachSegmentsRequest) NewStartPositionDeprecated() uint16 { 267 return 0 268 } 269 270 func (*DetachSegmentsRequest) NewStartPositionMetaAttribute(meta int) string { 271 switch meta { 272 case 1: 273 return "" 274 case 2: 275 return "" 276 case 3: 277 return "" 278 case 4: 279 return "required" 280 } 281 return "" 282 } 283 284 func (*DetachSegmentsRequest) NewStartPositionMinValue() int64 { 285 return math.MinInt64 + 1 286 } 287 288 func (*DetachSegmentsRequest) NewStartPositionMaxValue() int64 { 289 return math.MaxInt64 290 } 291 292 func (*DetachSegmentsRequest) NewStartPositionNullValue() int64 { 293 return math.MinInt64 294 }