vitess.io/vitess@v0.16.2/go/vt/tableacl/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 tableacl 19 20 import hack "vitess.io/vitess/go/hack" 21 22 type cachedObject interface { 23 CachedSize(alloc bool) int64 24 } 25 26 func (cached *ACLResult) CachedSize(alloc bool) int64 { 27 if cached == nil { 28 return int64(0) 29 } 30 size := int64(0) 31 if alloc { 32 size += int64(32) 33 } 34 // field ACL vitess.io/vitess/go/vt/tableacl/acl.ACL 35 if cc, ok := cached.ACL.(cachedObject); ok { 36 size += cc.CachedSize(true) 37 } 38 // field GroupName string 39 size += hack.RuntimeAllocSize(int64(len(cached.GroupName))) 40 return size 41 }