parser

package
v0.0.0-...-1b293c9 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dereference

func Dereference[
	TValue any,
	TReference any,
](
	ctx context.Context,
	reader ParsedObjectReader[model_core.Decodable[TReference], TValue],
	m model_core.Message[*model_core_pb.DecodableReference, TReference],
) (TValue, error)

Dereference a reference message, returning the value that's associated with it.

func MaybeDereference

func MaybeDereference[
	TValue any,
	TReference any,
](
	ctx context.Context,
	reader ParsedObjectReader[model_core.Decodable[TReference], TValue],
	m model_core.Message[*model_core_pb.DecodableReference, TReference],
) (TValue, error)

MaybeDereference is identical to Dereference, except that it returns a default instance in case the reference message is not set.

Types

type ObjectParser

type ObjectParser[TReference, TParsedObject any] interface {
	ParseObject(in model_core.Message[[]byte, TReference], decodingParameters []byte) (TParsedObject, int, error)
	GetDecodingParametersSizeBytes() int
}

func NewChainedObjectParser

func NewChainedObjectParser[TReference, TParsedObject any](parserA ObjectParser[TReference, model_core.Message[[]byte, TReference]], parserB ObjectParser[TReference, TParsedObject]) ObjectParser[TReference, TParsedObject]

func NewEncodedObjectParser

func NewEncodedObjectParser[
	TReference any,
](encoder model_encoding.BinaryEncoder) ObjectParser[TReference, model_core.Message[[]byte, TReference]]

func NewProtoListObjectParser

func NewProtoListObjectParser[
	TReference any,
	TMessage any,
	TMessagePtr interface {
		*TMessage
		proto.Message
	},
]() ObjectParser[TReference, model_core.Message[[]TMessagePtr, TReference]]

NewProtoListObjectParser is capable of unmarshaling objects containing a list of Protobuf messages. Messages are prefixed with their size, encoded as a variable length integer.

func NewProtoObjectParser

func NewProtoObjectParser[
	TReference any,
	TMessage any,
	TMessagePtr interface {
		*TMessage
		proto.Message
	},
]() ObjectParser[TReference, model_core.Message[TMessagePtr, TReference]]

func NewRawObjectParser

func NewRawObjectParser[TReference any]() ObjectParser[TReference, []byte]

type ParsedObjectEvictionKey

type ParsedObjectEvictionKey struct {
	// contains filtered or unexported fields
}

type ParsedObjectPool

type ParsedObjectPool struct {
	// contains filtered or unexported fields
}

func NewParsedObjectPool

func NewParsedObjectPool(evictionSet eviction.Set[ParsedObjectEvictionKey], maximumCount, maximumSizeBytes int) *ParsedObjectPool

func NewParsedObjectPoolFromConfiguration

func NewParsedObjectPoolFromConfiguration(configuration *model_parser_cfg_pb.ParsedObjectPool) (*ParsedObjectPool, error)

type ParsedObjectPoolIngester

type ParsedObjectPoolIngester[TReference any] struct {
	// contains filtered or unexported fields
}

func NewParsedObjectPoolIngester

func NewParsedObjectPoolIngester[TReference any](
	pool *ParsedObjectPool,
	rawReader ParsedObjectReader[TReference, model_core.Message[[]byte, TReference]],
) *ParsedObjectPoolIngester[TReference]

type ParsedObjectReader

type ParsedObjectReader[TReference, TParsedObject any] interface {
	ReadParsedObject(ctx context.Context, reference TReference) (TParsedObject, error)
	GetDecodingParametersSizeBytes() int
}

func LookupParsedObjectReader

func LookupParsedObjectReader[TReference object.BasicReference, TParsedObject any](
	ingester *ParsedObjectPoolIngester[TReference],
	parser ObjectParser[TReference, TParsedObject],
) ParsedObjectReader[model_core.Decodable[TReference], TParsedObject]

func NewDownloadingParsedObjectReader

func NewDownloadingParsedObjectReader[TReference any](downloader object.Downloader[TReference]) ParsedObjectReader[TReference, model_core.Message[[]byte, object.LocalReference]]

Jump to

Keyboard shortcuts

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