mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 18:13:42 +08:00 
			
		
		
		
	Integrates vtproto into buildx. The generated files dockerfile has been modified to copy the buildkit equivalent file to ensure files are laid out in the appropriate way for imports. An import has also been included to change the grpc codec to the version in buildkit that supports vtproto. This will allow buildx to utilize the speed and memory improvements from that. Also updates the gc control options for prune. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright (c) 2021 PlanetScale Inc. All rights reserved.
 | 
						|
// Use of this source code is governed by a BSD-style
 | 
						|
// license that can be found in the LICENSE file.
 | 
						|
 | 
						|
package generator
 | 
						|
 | 
						|
import (
 | 
						|
	"google.golang.org/protobuf/encoding/protowire"
 | 
						|
	"google.golang.org/protobuf/reflect/protoreflect"
 | 
						|
)
 | 
						|
 | 
						|
const ProtoPkg = "google.golang.org/protobuf/proto"
 | 
						|
 | 
						|
func KeySize(fieldNumber protoreflect.FieldNumber, wireType protowire.Type) int {
 | 
						|
	x := uint32(fieldNumber)<<3 | uint32(wireType)
 | 
						|
	size := 0
 | 
						|
	for size = 0; x > 127; size++ {
 | 
						|
		x >>= 7
 | 
						|
	}
 | 
						|
	size++
 | 
						|
	return size
 | 
						|
}
 | 
						|
 | 
						|
var wireTypes = map[protoreflect.Kind]protowire.Type{
 | 
						|
	protoreflect.BoolKind:     protowire.VarintType,
 | 
						|
	protoreflect.EnumKind:     protowire.VarintType,
 | 
						|
	protoreflect.Int32Kind:    protowire.VarintType,
 | 
						|
	protoreflect.Sint32Kind:   protowire.VarintType,
 | 
						|
	protoreflect.Uint32Kind:   protowire.VarintType,
 | 
						|
	protoreflect.Int64Kind:    protowire.VarintType,
 | 
						|
	protoreflect.Sint64Kind:   protowire.VarintType,
 | 
						|
	protoreflect.Uint64Kind:   protowire.VarintType,
 | 
						|
	protoreflect.Sfixed32Kind: protowire.Fixed32Type,
 | 
						|
	protoreflect.Fixed32Kind:  protowire.Fixed32Type,
 | 
						|
	protoreflect.FloatKind:    protowire.Fixed32Type,
 | 
						|
	protoreflect.Sfixed64Kind: protowire.Fixed64Type,
 | 
						|
	protoreflect.Fixed64Kind:  protowire.Fixed64Type,
 | 
						|
	protoreflect.DoubleKind:   protowire.Fixed64Type,
 | 
						|
	protoreflect.StringKind:   protowire.BytesType,
 | 
						|
	protoreflect.BytesKind:    protowire.BytesType,
 | 
						|
	protoreflect.MessageKind:  protowire.BytesType,
 | 
						|
	protoreflect.GroupKind:    protowire.StartGroupType,
 | 
						|
}
 | 
						|
 | 
						|
func ProtoWireType(k protoreflect.Kind) protowire.Type {
 | 
						|
	return wireTypes[k]
 | 
						|
}
 |