protobufgoogle.golang.org/protobuf/internal/protolazy Index | Files

package protolazy

import "google.golang.org/protobuf/internal/protolazy"

Package protolazy contains internal data structures for lazy message decoding.

Index

Types

type BufferReader

type BufferReader struct {
	Buf []byte
	Pos int
}

BufferReader is a structure encapsulating a protobuf and a current position

func NewBufferReader

func NewBufferReader(buf []byte) BufferReader

NewBufferReader creates a new BufferRead from a protobuf

func (*BufferReader) DecodeVarint

func (b *BufferReader) DecodeVarint() (x uint64, err error)

decodeVarint decodes a varint at the current position

func (*BufferReader) DecodeVarint32

func (b *BufferReader) DecodeVarint32() (x uint32, err error)

decodeVarint32 decodes a varint32 at the current position

func (*BufferReader) DecodeVarintSlow

func (b *BufferReader) DecodeVarintSlow() (x uint64, err error)

func (*BufferReader) Done

func (b *BufferReader) Done() bool

Done returns whether we are at the end of the protobuf

func (*BufferReader) Remaining

func (b *BufferReader) Remaining() int

Remaining returns how many bytes remain

func (*BufferReader) Skip

func (b *BufferReader) Skip(n int) (err error)

skip skips the specified number of bytes

func (*BufferReader) SkipBytes

func (b *BufferReader) SkipBytes() (err error)

skipBytes skips a set of bytes

func (*BufferReader) SkipFixed32

func (b *BufferReader) SkipFixed32() (err error)

skipFixed32 skips a fixed32

func (*BufferReader) SkipFixed64

func (b *BufferReader) SkipFixed64() (err error)

skipFixed64 skips a fixed64

func (*BufferReader) SkipGroup

func (b *BufferReader) SkipGroup(tag uint32) (err error)

skipGroup skips a group with the specified tag. It executes efficiently using a tag stack

func (*BufferReader) SkipValue

func (b *BufferReader) SkipValue(tag uint32) (err error)

skipValue skips a value in the protobuf, based on the specified tag

func (*BufferReader) SkipVarint

func (b *BufferReader) SkipVarint() (err error)

skipVarint effiently skips a varint

type IndexEntry

type IndexEntry struct {
	FieldNum uint32
	// first byte of this tag/field
	Start uint32
	// first byte after a contiguous sequence of bytes for this tag/field, which could
	// include a single encoding of the field, or multiple encodings for the field
	End uint32
	// True if this protobuf segment includes multiple encodings of the field
	MultipleContiguous bool
}

IndexEntry is the structure for an index of the fields in a message of a proto (not descending to sub-messages)

type XXX_lazyUnmarshalInfo

type XXX_lazyUnmarshalInfo struct {

	// The protobuf associated with this lazily decoded message.  It is
	// only set during proto.Unmarshal().  It doesn't need to be set and
	// loaded atomically, since any simultaneous set (Unmarshal) and read
	// (during a get) would already be a race in the app code.
	Protobuf []byte
	// contains filtered or unexported fields
}

XXX_lazyUnmarshalInfo has information about a particular lazily decoded message

Deprecated: Do not use. This will be deleted in the near future.

func (*XXX_lazyUnmarshalInfo) AllowedPartial

func (lazy *XXX_lazyUnmarshalInfo) AllowedPartial() bool

AllowedPartial returns true if the user originally unmarshalled this message with AllowPartial set to true

func (*XXX_lazyUnmarshalInfo) AppendField

func (lazy *XXX_lazyUnmarshalInfo) AppendField(b []byte, num uint32) ([]byte, bool)

func (*XXX_lazyUnmarshalInfo) Buffer

func (lazy *XXX_lazyUnmarshalInfo) Buffer() []byte

Buffer returns the lazy unmarshal buffer.

Deprecated: Do not use. This will be deleted in the near future.

func (*XXX_lazyUnmarshalInfo) FindFieldInProto

func (lazy *XXX_lazyUnmarshalInfo) FindFieldInProto(fieldNum uint32) (start, end uint32, found, multipleContiguous bool, multipleEntries []IndexEntry)

FindFieldInProto looks for field fieldNum in lazyUnmarshalInfo information (including protobuf), returns startOffset/endOffset/found.

func (*XXX_lazyUnmarshalInfo) SetBuffer

func (lazy *XXX_lazyUnmarshalInfo) SetBuffer(b []byte)

SetBuffer sets the lazy unmarshal buffer.

Deprecated: Do not use. This will be deleted in the near future.

func (*XXX_lazyUnmarshalInfo) SetIndex

func (lazy *XXX_lazyUnmarshalInfo) SetIndex(index []IndexEntry)

func (*XXX_lazyUnmarshalInfo) SetUnmarshalFlags

func (lazy *XXX_lazyUnmarshalInfo) SetUnmarshalFlags(f piface.UnmarshalInputFlags)

SetUnmarshalFlags is called to set a copy of the original unmarshalInputFlags. The flags should reflect how Unmarshal was called.

func (*XXX_lazyUnmarshalInfo) SizeField

func (lazy *XXX_lazyUnmarshalInfo) SizeField(num uint32) (size int)

func (*XXX_lazyUnmarshalInfo) UnmarshalFlags

func (lazy *XXX_lazyUnmarshalInfo) UnmarshalFlags() piface.UnmarshalInputFlags

UnmarshalFlags returns the original unmarshalInputFlags.

Source Files

bufferreader.go lazy.go pointer_unsafe.go

Version
v1.36.5 (latest)
Published
Feb 6, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
10 hours ago

Tools for package owners.