github.com/lirm/aeron-go@v0.0.0-20230415210743-920325491dc4/archive/codecs/MigrateSegmentsRequest.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 MigrateSegmentsRequest struct { 13 ControlSessionId int64 14 CorrelationId int64 15 SrcRecordingId int64 16 DstRecordingId int64 17 } 18 19 func (m *MigrateSegmentsRequest) Encode(_m *SbeGoMarshaller, _w io.Writer, doRangeCheck bool) error { 20 if doRangeCheck { 21 if err := m.RangeCheck(m.SbeSchemaVersion(), m.SbeSchemaVersion()); err != nil { 22 return err 23 } 24 } 25 if err := _m.WriteInt64(_w, m.ControlSessionId); err != nil { 26 return err 27 } 28 if err := _m.WriteInt64(_w, m.CorrelationId); err != nil { 29 return err 30 } 31 if err := _m.WriteInt64(_w, m.SrcRecordingId); err != nil { 32 return err 33 } 34 if err := _m.WriteInt64(_w, m.DstRecordingId); err != nil { 35 return err 36 } 37 return nil 38 } 39 40 func (m *MigrateSegmentsRequest) Decode(_m *SbeGoMarshaller, _r io.Reader, actingVersion uint16, blockLength uint16, doRangeCheck bool) error { 41 if !m.ControlSessionIdInActingVersion(actingVersion) { 42 m.ControlSessionId = m.ControlSessionIdNullValue() 43 } else { 44 if err := _m.ReadInt64(_r, &m.ControlSessionId); err != nil { 45 return err 46 } 47 } 48 if !m.CorrelationIdInActingVersion(actingVersion) { 49 m.CorrelationId = m.CorrelationIdNullValue() 50 } else { 51 if err := _m.ReadInt64(_r, &m.CorrelationId); err != nil { 52 return err 53 } 54 } 55 if !m.SrcRecordingIdInActingVersion(actingVersion) { 56 m.SrcRecordingId = m.SrcRecordingIdNullValue() 57 } else { 58 if err := _m.ReadInt64(_r, &m.SrcRecordingId); err != nil { 59 return err 60 } 61 } 62 if !m.DstRecordingIdInActingVersion(actingVersion) { 63 m.DstRecordingId = m.DstRecordingIdNullValue() 64 } else { 65 if err := _m.ReadInt64(_r, &m.DstRecordingId); err != nil { 66 return err 67 } 68 } 69 if actingVersion > m.SbeSchemaVersion() && blockLength > m.SbeBlockLength() { 70 io.CopyN(ioutil.Discard, _r, int64(blockLength-m.SbeBlockLength())) 71 } 72 if doRangeCheck { 73 if err := m.RangeCheck(actingVersion, m.SbeSchemaVersion()); err != nil { 74 return err 75 } 76 } 77 return nil 78 } 79 80 func (m *MigrateSegmentsRequest) RangeCheck(actingVersion uint16, schemaVersion uint16) error { 81 if m.ControlSessionIdInActingVersion(actingVersion) { 82 if m.ControlSessionId < m.ControlSessionIdMinValue() || m.ControlSessionId > m.ControlSessionIdMaxValue() { 83 return fmt.Errorf("Range check failed on m.ControlSessionId (%v < %v > %v)", m.ControlSessionIdMinValue(), m.ControlSessionId, m.ControlSessionIdMaxValue()) 84 } 85 } 86 if m.CorrelationIdInActingVersion(actingVersion) { 87 if m.CorrelationId < m.CorrelationIdMinValue() || m.CorrelationId > m.CorrelationIdMaxValue() { 88 return fmt.Errorf("Range check failed on m.CorrelationId (%v < %v > %v)", m.CorrelationIdMinValue(), m.CorrelationId, m.CorrelationIdMaxValue()) 89 } 90 } 91 if m.SrcRecordingIdInActingVersion(actingVersion) { 92 if m.SrcRecordingId < m.SrcRecordingIdMinValue() || m.SrcRecordingId > m.SrcRecordingIdMaxValue() { 93 return fmt.Errorf("Range check failed on m.SrcRecordingId (%v < %v > %v)", m.SrcRecordingIdMinValue(), m.SrcRecordingId, m.SrcRecordingIdMaxValue()) 94 } 95 } 96 if m.DstRecordingIdInActingVersion(actingVersion) { 97 if m.DstRecordingId < m.DstRecordingIdMinValue() || m.DstRecordingId > m.DstRecordingIdMaxValue() { 98 return fmt.Errorf("Range check failed on m.DstRecordingId (%v < %v > %v)", m.DstRecordingIdMinValue(), m.DstRecordingId, m.DstRecordingIdMaxValue()) 99 } 100 } 101 return nil 102 } 103 104 func MigrateSegmentsRequestInit(m *MigrateSegmentsRequest) { 105 return 106 } 107 108 func (*MigrateSegmentsRequest) SbeBlockLength() (blockLength uint16) { 109 return 32 110 } 111 112 func (*MigrateSegmentsRequest) SbeTemplateId() (templateId uint16) { 113 return 57 114 } 115 116 func (*MigrateSegmentsRequest) SbeSchemaId() (schemaId uint16) { 117 return 101 118 } 119 120 func (*MigrateSegmentsRequest) SbeSchemaVersion() (schemaVersion uint16) { 121 return 6 122 } 123 124 func (*MigrateSegmentsRequest) SbeSemanticType() (semanticType []byte) { 125 return []byte("") 126 } 127 128 func (*MigrateSegmentsRequest) ControlSessionIdId() uint16 { 129 return 1 130 } 131 132 func (*MigrateSegmentsRequest) ControlSessionIdSinceVersion() uint16 { 133 return 0 134 } 135 136 func (m *MigrateSegmentsRequest) ControlSessionIdInActingVersion(actingVersion uint16) bool { 137 return actingVersion >= m.ControlSessionIdSinceVersion() 138 } 139 140 func (*MigrateSegmentsRequest) ControlSessionIdDeprecated() uint16 { 141 return 0 142 } 143 144 func (*MigrateSegmentsRequest) 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 (*MigrateSegmentsRequest) ControlSessionIdMinValue() int64 { 159 return math.MinInt64 + 1 160 } 161 162 func (*MigrateSegmentsRequest) ControlSessionIdMaxValue() int64 { 163 return math.MaxInt64 164 } 165 166 func (*MigrateSegmentsRequest) ControlSessionIdNullValue() int64 { 167 return math.MinInt64 168 } 169 170 func (*MigrateSegmentsRequest) CorrelationIdId() uint16 { 171 return 2 172 } 173 174 func (*MigrateSegmentsRequest) CorrelationIdSinceVersion() uint16 { 175 return 0 176 } 177 178 func (m *MigrateSegmentsRequest) CorrelationIdInActingVersion(actingVersion uint16) bool { 179 return actingVersion >= m.CorrelationIdSinceVersion() 180 } 181 182 func (*MigrateSegmentsRequest) CorrelationIdDeprecated() uint16 { 183 return 0 184 } 185 186 func (*MigrateSegmentsRequest) 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 (*MigrateSegmentsRequest) CorrelationIdMinValue() int64 { 201 return math.MinInt64 + 1 202 } 203 204 func (*MigrateSegmentsRequest) CorrelationIdMaxValue() int64 { 205 return math.MaxInt64 206 } 207 208 func (*MigrateSegmentsRequest) CorrelationIdNullValue() int64 { 209 return math.MinInt64 210 } 211 212 func (*MigrateSegmentsRequest) SrcRecordingIdId() uint16 { 213 return 3 214 } 215 216 func (*MigrateSegmentsRequest) SrcRecordingIdSinceVersion() uint16 { 217 return 0 218 } 219 220 func (m *MigrateSegmentsRequest) SrcRecordingIdInActingVersion(actingVersion uint16) bool { 221 return actingVersion >= m.SrcRecordingIdSinceVersion() 222 } 223 224 func (*MigrateSegmentsRequest) SrcRecordingIdDeprecated() uint16 { 225 return 0 226 } 227 228 func (*MigrateSegmentsRequest) SrcRecordingIdMetaAttribute(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 (*MigrateSegmentsRequest) SrcRecordingIdMinValue() int64 { 243 return math.MinInt64 + 1 244 } 245 246 func (*MigrateSegmentsRequest) SrcRecordingIdMaxValue() int64 { 247 return math.MaxInt64 248 } 249 250 func (*MigrateSegmentsRequest) SrcRecordingIdNullValue() int64 { 251 return math.MinInt64 252 } 253 254 func (*MigrateSegmentsRequest) DstRecordingIdId() uint16 { 255 return 4 256 } 257 258 func (*MigrateSegmentsRequest) DstRecordingIdSinceVersion() uint16 { 259 return 0 260 } 261 262 func (m *MigrateSegmentsRequest) DstRecordingIdInActingVersion(actingVersion uint16) bool { 263 return actingVersion >= m.DstRecordingIdSinceVersion() 264 } 265 266 func (*MigrateSegmentsRequest) DstRecordingIdDeprecated() uint16 { 267 return 0 268 } 269 270 func (*MigrateSegmentsRequest) DstRecordingIdMetaAttribute(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 (*MigrateSegmentsRequest) DstRecordingIdMinValue() int64 { 285 return math.MinInt64 + 1 286 } 287 288 func (*MigrateSegmentsRequest) DstRecordingIdMaxValue() int64 { 289 return math.MaxInt64 290 } 291 292 func (*MigrateSegmentsRequest) DstRecordingIdNullValue() int64 { 293 return math.MinInt64 294 }