protolazy

package
v1.36.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package protolazy contains internal data structures for lazy message decoding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 deprecated

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 deprecated

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 deprecated

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL