vitess.io/vitess@v0.16.2/go/vt/vttablet/tabletserver/planbuilder/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 planbuilder 19 20 import hack "vitess.io/vitess/go/hack" 21 22 type cachedObject interface { 23 CachedSize(alloc bool) int64 24 } 25 26 func (cached *Permission) CachedSize(alloc bool) int64 { 27 if cached == nil { 28 return int64(0) 29 } 30 size := int64(0) 31 if alloc { 32 size += int64(24) 33 } 34 // field TableName string 35 size += hack.RuntimeAllocSize(int64(len(cached.TableName))) 36 return size 37 } 38 func (cached *Plan) CachedSize(alloc bool) int64 { 39 if cached == nil { 40 return int64(0) 41 } 42 size := int64(0) 43 if alloc { 44 size += int64(128) 45 } 46 // field Table *vitess.io/vitess/go/vt/vttablet/tabletserver/schema.Table 47 size += cached.Table.CachedSize(true) 48 // field AllTables []*vitess.io/vitess/go/vt/vttablet/tabletserver/schema.Table 49 { 50 size += hack.RuntimeAllocSize(int64(cap(cached.AllTables)) * int64(8)) 51 for _, elem := range cached.AllTables { 52 size += elem.CachedSize(true) 53 } 54 } 55 // field Permissions []vitess.io/vitess/go/vt/vttablet/tabletserver/planbuilder.Permission 56 { 57 size += hack.RuntimeAllocSize(int64(cap(cached.Permissions)) * int64(24)) 58 for _, elem := range cached.Permissions { 59 size += elem.CachedSize(false) 60 } 61 } 62 // field FullQuery *vitess.io/vitess/go/vt/sqlparser.ParsedQuery 63 size += cached.FullQuery.CachedSize(true) 64 // field NextCount vitess.io/vitess/go/vt/vtgate/evalengine.Expr 65 if cc, ok := cached.NextCount.(cachedObject); ok { 66 size += cc.CachedSize(true) 67 } 68 // field WhereClause *vitess.io/vitess/go/vt/sqlparser.ParsedQuery 69 size += cached.WhereClause.CachedSize(true) 70 // field FullStmt vitess.io/vitess/go/vt/sqlparser.Statement 71 if cc, ok := cached.FullStmt.(cachedObject); ok { 72 size += cc.CachedSize(true) 73 } 74 return size 75 }