vitess.io/vitess@v0.16.2/go/vt/vttablet/tabletserver/schema/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 schema
    19  
    20  import hack "vitess.io/vitess/go/hack"
    21  
    22  func (cached *MessageInfo) CachedSize(alloc bool) int64 {
    23  	if cached == nil {
    24  		return int64(0)
    25  	}
    26  	size := int64(0)
    27  	if alloc {
    28  		size += int64(80)
    29  	}
    30  	// field Fields []*vitess.io/vitess/go/vt/proto/query.Field
    31  	{
    32  		size += hack.RuntimeAllocSize(int64(cap(cached.Fields)) * int64(8))
    33  		for _, elem := range cached.Fields {
    34  			size += elem.CachedSize(true)
    35  		}
    36  	}
    37  	return size
    38  }
    39  func (cached *Table) CachedSize(alloc bool) int64 {
    40  	if cached == nil {
    41  		return int64(0)
    42  	}
    43  	size := int64(0)
    44  	if alloc {
    45  		size += int64(112)
    46  	}
    47  	// field Name vitess.io/vitess/go/vt/sqlparser.IdentifierCS
    48  	size += cached.Name.CachedSize(false)
    49  	// field Fields []*vitess.io/vitess/go/vt/proto/query.Field
    50  	{
    51  		size += hack.RuntimeAllocSize(int64(cap(cached.Fields)) * int64(8))
    52  		for _, elem := range cached.Fields {
    53  			size += elem.CachedSize(true)
    54  		}
    55  	}
    56  	// field PKColumns []int
    57  	{
    58  		size += hack.RuntimeAllocSize(int64(cap(cached.PKColumns)) * int64(8))
    59  	}
    60  	// field SequenceInfo *vitess.io/vitess/go/vt/vttablet/tabletserver/schema.SequenceInfo
    61  	if cached.SequenceInfo != nil {
    62  		size += hack.RuntimeAllocSize(int64(24))
    63  	}
    64  	// field MessageInfo *vitess.io/vitess/go/vt/vttablet/tabletserver/schema.MessageInfo
    65  	size += cached.MessageInfo.CachedSize(true)
    66  	return size
    67  }