vitess.io/vitess@v0.16.2/go/vt/vtgate/vindexes/cached_size.go (about) 1 /* 2 Copyright 2021 The Vitess Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 // Code generated by Sizegen. DO NOT EDIT. 17 18 package vindexes 19 20 import ( 21 "math" 22 "reflect" 23 "unsafe" 24 25 hack "vitess.io/vitess/go/hack" 26 ) 27 28 type cachedObject interface { 29 CachedSize(alloc bool) int64 30 } 31 32 func (cached *AutoIncrement) CachedSize(alloc bool) int64 { 33 if cached == nil { 34 return int64(0) 35 } 36 size := int64(0) 37 if alloc { 38 size += int64(48) 39 } 40 // field Column vitess.io/vitess/go/vt/sqlparser.IdentifierCI 41 size += cached.Column.CachedSize(false) 42 // field Sequence *vitess.io/vitess/go/vt/vtgate/vindexes.Table 43 size += cached.Sequence.CachedSize(true) 44 return size 45 } 46 func (cached *Binary) CachedSize(alloc bool) int64 { 47 if cached == nil { 48 return int64(0) 49 } 50 size := int64(0) 51 if alloc { 52 size += int64(16) 53 } 54 // field name string 55 size += hack.RuntimeAllocSize(int64(len(cached.name))) 56 return size 57 } 58 func (cached *BinaryMD5) CachedSize(alloc bool) int64 { 59 if cached == nil { 60 return int64(0) 61 } 62 size := int64(0) 63 if alloc { 64 size += int64(16) 65 } 66 // field name string 67 size += hack.RuntimeAllocSize(int64(len(cached.name))) 68 return size 69 } 70 func (cached *CFC) CachedSize(alloc bool) int64 { 71 if cached == nil { 72 return int64(0) 73 } 74 size := int64(0) 75 if alloc { 76 size += int64(16) 77 } 78 // field cfcCommon *vitess.io/vitess/go/vt/vtgate/vindexes.cfcCommon 79 size += cached.cfcCommon.CachedSize(true) 80 // field prefixCFC *vitess.io/vitess/go/vt/vtgate/vindexes.prefixCFC 81 size += cached.prefixCFC.CachedSize(true) 82 return size 83 } 84 func (cached *Column) CachedSize(alloc bool) int64 { 85 if cached == nil { 86 return int64(0) 87 } 88 size := int64(0) 89 if alloc { 90 size += int64(64) 91 } 92 // field Name vitess.io/vitess/go/vt/sqlparser.IdentifierCI 93 size += cached.Name.CachedSize(false) 94 // field CollationName string 95 size += hack.RuntimeAllocSize(int64(len(cached.CollationName))) 96 return size 97 } 98 func (cached *ColumnVindex) CachedSize(alloc bool) int64 { 99 if cached == nil { 100 return int64(0) 101 } 102 size := int64(0) 103 if alloc { 104 size += int64(112) 105 } 106 // field Columns []vitess.io/vitess/go/vt/sqlparser.IdentifierCI 107 { 108 size += hack.RuntimeAllocSize(int64(cap(cached.Columns)) * int64(32)) 109 for _, elem := range cached.Columns { 110 size += elem.CachedSize(false) 111 } 112 } 113 // field Type string 114 size += hack.RuntimeAllocSize(int64(len(cached.Type))) 115 // field Name string 116 size += hack.RuntimeAllocSize(int64(len(cached.Name))) 117 // field Vindex vitess.io/vitess/go/vt/vtgate/vindexes.Vindex 118 if cc, ok := cached.Vindex.(cachedObject); ok { 119 size += cc.CachedSize(true) 120 } 121 return size 122 } 123 func (cached *ConsistentLookup) CachedSize(alloc bool) int64 { 124 if cached == nil { 125 return int64(0) 126 } 127 size := int64(0) 128 if alloc { 129 size += int64(8) 130 } 131 // field clCommon *vitess.io/vitess/go/vt/vtgate/vindexes.clCommon 132 size += cached.clCommon.CachedSize(true) 133 return size 134 } 135 func (cached *ConsistentLookupUnique) CachedSize(alloc bool) int64 { 136 if cached == nil { 137 return int64(0) 138 } 139 size := int64(0) 140 if alloc { 141 size += int64(8) 142 } 143 // field clCommon *vitess.io/vitess/go/vt/vtgate/vindexes.clCommon 144 size += cached.clCommon.CachedSize(true) 145 return size 146 } 147 func (cached *Hash) CachedSize(alloc bool) int64 { 148 if cached == nil { 149 return int64(0) 150 } 151 size := int64(0) 152 if alloc { 153 size += int64(16) 154 } 155 // field name string 156 size += hack.RuntimeAllocSize(int64(len(cached.name))) 157 return size 158 } 159 func (cached *Keyspace) CachedSize(alloc bool) int64 { 160 if cached == nil { 161 return int64(0) 162 } 163 size := int64(0) 164 if alloc { 165 size += int64(24) 166 } 167 // field Name string 168 size += hack.RuntimeAllocSize(int64(len(cached.Name))) 169 return size 170 } 171 func (cached *LookupHash) CachedSize(alloc bool) int64 { 172 if cached == nil { 173 return int64(0) 174 } 175 size := int64(0) 176 if alloc { 177 size += int64(176) 178 } 179 // field name string 180 size += hack.RuntimeAllocSize(int64(len(cached.name))) 181 // field lkp vitess.io/vitess/go/vt/vtgate/vindexes.lookupInternal 182 size += cached.lkp.CachedSize(false) 183 return size 184 } 185 func (cached *LookupHashUnique) CachedSize(alloc bool) int64 { 186 if cached == nil { 187 return int64(0) 188 } 189 size := int64(0) 190 if alloc { 191 size += int64(176) 192 } 193 // field name string 194 size += hack.RuntimeAllocSize(int64(len(cached.name))) 195 // field lkp vitess.io/vitess/go/vt/vtgate/vindexes.lookupInternal 196 size += cached.lkp.CachedSize(false) 197 return size 198 } 199 func (cached *LookupNonUnique) CachedSize(alloc bool) int64 { 200 if cached == nil { 201 return int64(0) 202 } 203 size := int64(0) 204 if alloc { 205 size += int64(176) 206 } 207 // field name string 208 size += hack.RuntimeAllocSize(int64(len(cached.name))) 209 // field lkp vitess.io/vitess/go/vt/vtgate/vindexes.lookupInternal 210 size += cached.lkp.CachedSize(false) 211 return size 212 } 213 func (cached *LookupUnicodeLooseMD5Hash) CachedSize(alloc bool) int64 { 214 if cached == nil { 215 return int64(0) 216 } 217 size := int64(0) 218 if alloc { 219 size += int64(176) 220 } 221 // field name string 222 size += hack.RuntimeAllocSize(int64(len(cached.name))) 223 // field lkp vitess.io/vitess/go/vt/vtgate/vindexes.lookupInternal 224 size += cached.lkp.CachedSize(false) 225 return size 226 } 227 func (cached *LookupUnicodeLooseMD5HashUnique) CachedSize(alloc bool) int64 { 228 if cached == nil { 229 return int64(0) 230 } 231 size := int64(0) 232 if alloc { 233 size += int64(176) 234 } 235 // field name string 236 size += hack.RuntimeAllocSize(int64(len(cached.name))) 237 // field lkp vitess.io/vitess/go/vt/vtgate/vindexes.lookupInternal 238 size += cached.lkp.CachedSize(false) 239 return size 240 } 241 func (cached *LookupUnique) CachedSize(alloc bool) int64 { 242 if cached == nil { 243 return int64(0) 244 } 245 size := int64(0) 246 if alloc { 247 size += int64(176) 248 } 249 // field name string 250 size += hack.RuntimeAllocSize(int64(len(cached.name))) 251 // field lkp vitess.io/vitess/go/vt/vtgate/vindexes.lookupInternal 252 size += cached.lkp.CachedSize(false) 253 return size 254 } 255 256 //go:nocheckptr 257 func (cached *MultiCol) CachedSize(alloc bool) int64 { 258 if cached == nil { 259 return int64(0) 260 } 261 size := int64(0) 262 if alloc { 263 size += int64(48) 264 } 265 // field name string 266 size += hack.RuntimeAllocSize(int64(len(cached.name))) 267 // field columnVdx map[int]vitess.io/vitess/go/vt/vtgate/vindexes.Hashing 268 if cached.columnVdx != nil { 269 size += int64(48) 270 hmap := reflect.ValueOf(cached.columnVdx) 271 numBuckets := int(math.Pow(2, float64((*(*uint8)(unsafe.Pointer(hmap.Pointer() + uintptr(9))))))) 272 numOldBuckets := (*(*uint16)(unsafe.Pointer(hmap.Pointer() + uintptr(10)))) 273 size += hack.RuntimeAllocSize(int64(numOldBuckets * 208)) 274 if len(cached.columnVdx) > 0 || numBuckets > 1 { 275 size += hack.RuntimeAllocSize(int64(numBuckets * 208)) 276 } 277 for _, v := range cached.columnVdx { 278 if cc, ok := v.(cachedObject); ok { 279 size += cc.CachedSize(true) 280 } 281 } 282 } 283 // field columnBytes map[int]int 284 if cached.columnBytes != nil { 285 size += int64(48) 286 hmap := reflect.ValueOf(cached.columnBytes) 287 numBuckets := int(math.Pow(2, float64((*(*uint8)(unsafe.Pointer(hmap.Pointer() + uintptr(9))))))) 288 numOldBuckets := (*(*uint16)(unsafe.Pointer(hmap.Pointer() + uintptr(10)))) 289 size += hack.RuntimeAllocSize(int64(numOldBuckets * 144)) 290 if len(cached.columnBytes) > 0 || numBuckets > 1 { 291 size += hack.RuntimeAllocSize(int64(numBuckets * 144)) 292 } 293 } 294 return size 295 } 296 func (cached *Null) CachedSize(alloc bool) int64 { 297 if cached == nil { 298 return int64(0) 299 } 300 size := int64(0) 301 if alloc { 302 size += int64(16) 303 } 304 // field name string 305 size += hack.RuntimeAllocSize(int64(len(cached.name))) 306 return size 307 } 308 func (cached *Numeric) CachedSize(alloc bool) int64 { 309 if cached == nil { 310 return int64(0) 311 } 312 size := int64(0) 313 if alloc { 314 size += int64(16) 315 } 316 // field name string 317 size += hack.RuntimeAllocSize(int64(len(cached.name))) 318 return size 319 } 320 321 //go:nocheckptr 322 func (cached *NumericStaticMap) CachedSize(alloc bool) int64 { 323 if cached == nil { 324 return int64(0) 325 } 326 size := int64(0) 327 if alloc { 328 size += int64(24) 329 } 330 // field name string 331 size += hack.RuntimeAllocSize(int64(len(cached.name))) 332 // field lookup vitess.io/vitess/go/vt/vtgate/vindexes.NumericLookupTable 333 if cached.lookup != nil { 334 size += int64(48) 335 hmap := reflect.ValueOf(cached.lookup) 336 numBuckets := int(math.Pow(2, float64((*(*uint8)(unsafe.Pointer(hmap.Pointer() + uintptr(9))))))) 337 numOldBuckets := (*(*uint16)(unsafe.Pointer(hmap.Pointer() + uintptr(10)))) 338 size += hack.RuntimeAllocSize(int64(numOldBuckets * 144)) 339 if len(cached.lookup) > 0 || numBuckets > 1 { 340 size += hack.RuntimeAllocSize(int64(numBuckets * 144)) 341 } 342 } 343 return size 344 } 345 func (cached *RegionExperimental) CachedSize(alloc bool) int64 { 346 if cached == nil { 347 return int64(0) 348 } 349 size := int64(0) 350 if alloc { 351 size += int64(24) 352 } 353 // field name string 354 size += hack.RuntimeAllocSize(int64(len(cached.name))) 355 return size 356 } 357 358 //go:nocheckptr 359 func (cached *RegionJSON) CachedSize(alloc bool) int64 { 360 if cached == nil { 361 return int64(0) 362 } 363 size := int64(0) 364 if alloc { 365 size += int64(32) 366 } 367 // field name string 368 size += hack.RuntimeAllocSize(int64(len(cached.name))) 369 // field regionMap vitess.io/vitess/go/vt/vtgate/vindexes.RegionMap 370 if cached.regionMap != nil { 371 size += int64(48) 372 hmap := reflect.ValueOf(cached.regionMap) 373 numBuckets := int(math.Pow(2, float64((*(*uint8)(unsafe.Pointer(hmap.Pointer() + uintptr(9))))))) 374 numOldBuckets := (*(*uint16)(unsafe.Pointer(hmap.Pointer() + uintptr(10)))) 375 size += hack.RuntimeAllocSize(int64(numOldBuckets * 208)) 376 if len(cached.regionMap) > 0 || numBuckets > 1 { 377 size += hack.RuntimeAllocSize(int64(numBuckets * 208)) 378 } 379 for k := range cached.regionMap { 380 size += hack.RuntimeAllocSize(int64(len(k))) 381 } 382 } 383 return size 384 } 385 func (cached *ReverseBits) CachedSize(alloc bool) int64 { 386 if cached == nil { 387 return int64(0) 388 } 389 size := int64(0) 390 if alloc { 391 size += int64(16) 392 } 393 // field name string 394 size += hack.RuntimeAllocSize(int64(len(cached.name))) 395 return size 396 } 397 func (cached *Source) CachedSize(alloc bool) int64 { 398 if cached == nil { 399 return int64(0) 400 } 401 size := int64(0) 402 if alloc { 403 size += int64(32) 404 } 405 // field TableName vitess.io/vitess/go/vt/sqlparser.TableName 406 size += cached.TableName.CachedSize(false) 407 return size 408 } 409 410 //go:nocheckptr 411 func (cached *Table) CachedSize(alloc bool) int64 { 412 if cached == nil { 413 return int64(0) 414 } 415 size := int64(0) 416 if alloc { 417 size += int64(192) 418 } 419 // field Type string 420 size += hack.RuntimeAllocSize(int64(len(cached.Type))) 421 // field Name vitess.io/vitess/go/vt/sqlparser.IdentifierCS 422 size += cached.Name.CachedSize(false) 423 // field Keyspace *vitess.io/vitess/go/vt/vtgate/vindexes.Keyspace 424 size += cached.Keyspace.CachedSize(true) 425 // field ColumnVindexes []*vitess.io/vitess/go/vt/vtgate/vindexes.ColumnVindex 426 { 427 size += hack.RuntimeAllocSize(int64(cap(cached.ColumnVindexes)) * int64(8)) 428 for _, elem := range cached.ColumnVindexes { 429 size += elem.CachedSize(true) 430 } 431 } 432 // field Ordered []*vitess.io/vitess/go/vt/vtgate/vindexes.ColumnVindex 433 { 434 size += hack.RuntimeAllocSize(int64(cap(cached.Ordered)) * int64(8)) 435 for _, elem := range cached.Ordered { 436 size += elem.CachedSize(true) 437 } 438 } 439 // field Owned []*vitess.io/vitess/go/vt/vtgate/vindexes.ColumnVindex 440 { 441 size += hack.RuntimeAllocSize(int64(cap(cached.Owned)) * int64(8)) 442 for _, elem := range cached.Owned { 443 size += elem.CachedSize(true) 444 } 445 } 446 // field AutoIncrement *vitess.io/vitess/go/vt/vtgate/vindexes.AutoIncrement 447 size += cached.AutoIncrement.CachedSize(true) 448 // field Columns []vitess.io/vitess/go/vt/vtgate/vindexes.Column 449 { 450 size += hack.RuntimeAllocSize(int64(cap(cached.Columns)) * int64(56)) 451 for _, elem := range cached.Columns { 452 size += elem.CachedSize(false) 453 } 454 } 455 // field Pinned []byte 456 { 457 size += hack.RuntimeAllocSize(int64(cap(cached.Pinned))) 458 } 459 // field ReferencedBy map[string]*vitess.io/vitess/go/vt/vtgate/vindexes.Table 460 if cached.ReferencedBy != nil { 461 size += int64(48) 462 hmap := reflect.ValueOf(cached.ReferencedBy) 463 numBuckets := int(math.Pow(2, float64((*(*uint8)(unsafe.Pointer(hmap.Pointer() + uintptr(9))))))) 464 numOldBuckets := (*(*uint16)(unsafe.Pointer(hmap.Pointer() + uintptr(10)))) 465 size += hack.RuntimeAllocSize(int64(numOldBuckets * 208)) 466 if len(cached.ReferencedBy) > 0 || numBuckets > 1 { 467 size += hack.RuntimeAllocSize(int64(numBuckets * 208)) 468 } 469 for k, v := range cached.ReferencedBy { 470 size += hack.RuntimeAllocSize(int64(len(k))) 471 size += v.CachedSize(true) 472 } 473 } 474 // field Source *vitess.io/vitess/go/vt/vtgate/vindexes.Source 475 size += cached.Source.CachedSize(true) 476 return size 477 } 478 func (cached *UnicodeLooseMD5) CachedSize(alloc bool) int64 { 479 if cached == nil { 480 return int64(0) 481 } 482 size := int64(0) 483 if alloc { 484 size += int64(16) 485 } 486 // field name string 487 size += hack.RuntimeAllocSize(int64(len(cached.name))) 488 return size 489 } 490 func (cached *UnicodeLooseXXHash) CachedSize(alloc bool) int64 { 491 if cached == nil { 492 return int64(0) 493 } 494 size := int64(0) 495 if alloc { 496 size += int64(16) 497 } 498 // field name string 499 size += hack.RuntimeAllocSize(int64(len(cached.name))) 500 return size 501 } 502 func (cached *XXHash) CachedSize(alloc bool) int64 { 503 if cached == nil { 504 return int64(0) 505 } 506 size := int64(0) 507 if alloc { 508 size += int64(16) 509 } 510 // field name string 511 size += hack.RuntimeAllocSize(int64(len(cached.name))) 512 return size 513 } 514 func (cached *cfcCommon) CachedSize(alloc bool) int64 { 515 if cached == nil { 516 return int64(0) 517 } 518 size := int64(0) 519 if alloc { 520 size += int64(48) 521 } 522 // field name string 523 size += hack.RuntimeAllocSize(int64(len(cached.name))) 524 // field offsets []int 525 { 526 size += hack.RuntimeAllocSize(int64(cap(cached.offsets)) * int64(8)) 527 } 528 return size 529 } 530 func (cached *clCommon) CachedSize(alloc bool) int64 { 531 if cached == nil { 532 return int64(0) 533 } 534 size := int64(0) 535 if alloc { 536 size += int64(288) 537 } 538 // field name string 539 size += hack.RuntimeAllocSize(int64(len(cached.name))) 540 // field lkp vitess.io/vitess/go/vt/vtgate/vindexes.lookupInternal 541 size += cached.lkp.CachedSize(false) 542 // field keyspace string 543 size += hack.RuntimeAllocSize(int64(len(cached.keyspace))) 544 // field ownerTable string 545 size += hack.RuntimeAllocSize(int64(len(cached.ownerTable))) 546 // field ownerColumns []string 547 { 548 size += hack.RuntimeAllocSize(int64(cap(cached.ownerColumns)) * int64(16)) 549 for _, elem := range cached.ownerColumns { 550 size += hack.RuntimeAllocSize(int64(len(elem))) 551 } 552 } 553 // field lockLookupQuery string 554 size += hack.RuntimeAllocSize(int64(len(cached.lockLookupQuery))) 555 // field lockOwnerQuery string 556 size += hack.RuntimeAllocSize(int64(len(cached.lockOwnerQuery))) 557 // field insertLookupQuery string 558 size += hack.RuntimeAllocSize(int64(len(cached.insertLookupQuery))) 559 // field updateLookupQuery string 560 size += hack.RuntimeAllocSize(int64(len(cached.updateLookupQuery))) 561 return size 562 } 563 func (cached *lookupInternal) CachedSize(alloc bool) int64 { 564 if cached == nil { 565 return int64(0) 566 } 567 size := int64(0) 568 if alloc { 569 size += int64(144) 570 } 571 // field Table string 572 size += hack.RuntimeAllocSize(int64(len(cached.Table))) 573 // field FromColumns []string 574 { 575 size += hack.RuntimeAllocSize(int64(cap(cached.FromColumns)) * int64(16)) 576 for _, elem := range cached.FromColumns { 577 size += hack.RuntimeAllocSize(int64(len(elem))) 578 } 579 } 580 // field To string 581 size += hack.RuntimeAllocSize(int64(len(cached.To))) 582 // field ReadLock string 583 size += hack.RuntimeAllocSize(int64(len(cached.ReadLock))) 584 // field sel string 585 size += hack.RuntimeAllocSize(int64(len(cached.sel))) 586 // field selTxDml string 587 size += hack.RuntimeAllocSize(int64(len(cached.selTxDml))) 588 // field ver string 589 size += hack.RuntimeAllocSize(int64(len(cached.ver))) 590 // field del string 591 size += hack.RuntimeAllocSize(int64(len(cached.del))) 592 return size 593 } 594 func (cached *prefixCFC) CachedSize(alloc bool) int64 { 595 if cached == nil { 596 return int64(0) 597 } 598 size := int64(0) 599 if alloc { 600 size += int64(8) 601 } 602 // field cfcCommon *vitess.io/vitess/go/vt/vtgate/vindexes.cfcCommon 603 size += cached.cfcCommon.CachedSize(true) 604 return size 605 }