1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package protolegacy is a stub version of the v1 proto package
// to satisfy internal/testprotos/legacy dependencies.
package protolegacy
import (
"bytes"
"compress/gzip"
"errors"
"fmt"
"io"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
"google.golang.org/protobuf/runtime/protoiface"
"google.golang.org/protobuf/runtime/protoimpl"
)
const (
ProtoPackageIsVersion1 = true
ProtoPackageIsVersion2 = true
ProtoPackageIsVersion3 = true
)
const (
WireVarint = 0
WireFixed32 = 5
WireFixed64 = 1
WireBytes = 2
WireStartGroup = 3
WireEndGroup = 4
)
type (
Message = protoiface.MessageV1
ExtensionRange = protoiface.ExtensionRangeV1
ExtensionDesc = protoimpl.ExtensionInfo
Extension = protoimpl.ExtensionFieldV1
XXX_InternalExtensions = protoimpl.ExtensionFields
)
func RegisterFile(s string, d []byte) {
// Decompress the descriptor.
zr, err := gzip.NewReader(bytes.NewReader(d))
if err != nil {
panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err))
}
b, err := io.ReadAll(zr)
if err != nil {
panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err))
}
// Construct a protoreflect.FileDescriptor from the raw descriptor.
// Note that DescBuilder.Build automatically registers the constructed
// file descriptor with the v2 registry.
protoimpl.DescBuilder{RawDescriptor: b}.Build()
}
func RegisterType(m Message, s string) {
mt := protoimpl.X.LegacyMessageTypeOf(m, protoreflect.FullName(s))
if err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil {
panic(err)
}
}
func RegisterMapType(any, string) {
// Do nothing.
}
func RegisterEnum(string, map[int32]string, map[string]int32) {
// Do nothing.
}
func RegisterExtension(d *ExtensionDesc) {
if err := protoregistry.GlobalTypes.RegisterExtension(d); err != nil {
panic(err)
}
}
var ErrInternalBadWireType = errors.New("not implemented")
func Size(Message) int { panic("not implemented") }
func Marshal(Message) ([]byte, error) { panic("not implemented") }
func Unmarshal([]byte, Message) error { panic("not implemented") }
func SizeVarint(uint64) int { panic("not implemented") }
func EncodeVarint(uint64) []byte { panic("not implemented") }
func DecodeVarint([]byte) (uint64, int) { panic("not implemented") }
func CompactTextString(Message) string { panic("not implemented") }
func EnumName(map[int32]string, int32) string { panic("not implemented") }
func UnmarshalJSONEnum(map[string]int32, []byte, string) (int32, error) { panic("not implemented") }
type Buffer struct{}
func (*Buffer) DecodeFixed32() (uint64, error) { panic("not implemented") }
func (*Buffer) DecodeFixed64() (uint64, error) { panic("not implemented") }
func (*Buffer) DecodeGroup(Message) error { panic("not implemented") }
func (*Buffer) DecodeMessage(Message) error { panic("not implemented") }
func (*Buffer) DecodeRawBytes(bool) ([]byte, error) { panic("not implemented") }
func (*Buffer) DecodeStringBytes() (string, error) { panic("not implemented") }
func (*Buffer) DecodeVarint() (uint64, error) { panic("not implemented") }
func (*Buffer) DecodeZigzag32() (uint64, error) { panic("not implemented") }
func (*Buffer) DecodeZigzag64() (uint64, error) { panic("not implemented") }
func (*Buffer) EncodeFixed32(uint64) error { panic("not implemented") }
func (*Buffer) EncodeFixed64(uint64) error { panic("not implemented") }
func (*Buffer) EncodeMessage(Message) error { panic("not implemented") }
func (*Buffer) EncodeRawBytes([]byte) error { panic("not implemented") }
func (*Buffer) EncodeStringBytes(string) error { panic("not implemented") }
func (*Buffer) EncodeVarint(uint64) error { panic("not implemented") }
func (*Buffer) EncodeZigzag32(uint64) error { panic("not implemented") }
func (*Buffer) EncodeZigzag64(uint64) error { panic("not implemented") }
func (*Buffer) Marshal(Message) error { panic("not implemented") }
func (*Buffer) Unmarshal(Message) error { panic("not implemented") }
type InternalMessageInfo struct{}
func (*InternalMessageInfo) DiscardUnknown(Message) { panic("not implemented") }
func (*InternalMessageInfo) Marshal([]byte, Message, bool) ([]byte, error) { panic("not implemented") }
func (*InternalMessageInfo) Merge(Message, Message) { panic("not implemented") }
func (*InternalMessageInfo) Size(Message) int { panic("not implemented") }
func (*InternalMessageInfo) Unmarshal(Message, []byte) error { panic("not implemented") }
|