proto

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package proto provides internal protobuf compilation utilities.

Package proto provides internal protobuf compilation utilities.

Index

Constants

This section is empty.

Variables

View Source
var GlobalPGOManager = NewPGOManager()

GlobalPGOManager is the default PGO manager instance.

Functions

func CompileMessageType

func CompileMessageType(md protoreflect.MessageDescriptor) (*hyperpb.MessageType, error)

CompileMessageType compiles a message descriptor into a hyperpb MessageType.

func CompileMessageTypeWithCache

func CompileMessageTypeWithCache(md protoreflect.MessageDescriptor, cache MessageTypeCache) (*hyperpb.MessageType, error)

CompileMessageTypeWithCache compiles a message descriptor with caching support.

func CompileMessageTypeWithOptions

func CompileMessageTypeWithOptions(md protoreflect.MessageDescriptor, opts []hyperpb.CompileOption) (*hyperpb.MessageType, error)

CompileMessageTypeWithOptions compiles a message descriptor into a hyperpb MessageType with options.

func CompileWithPGO

func CompileWithPGO(md protoreflect.MessageDescriptor, pgoManager *PGOManager) (*hyperpb.MessageType, error)

CompileWithPGO compiles a message descriptor with PGO support.

Types

type MessageTypeCache

type MessageTypeCache interface {
	Get(key string) (*hyperpb.MessageType, bool)
	Put(key string, msgType *hyperpb.MessageType)
}

MessageTypeCache defines the interface for caching compiled message types.

func GetGlobalCache

func GetGlobalCache() MessageTypeCache

GetGlobalCache returns the global message type cache.

type PGOManager

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

PGOManager manages profile-guided optimization for hyperpb message types.

func NewPGOManager

func NewPGOManager() *PGOManager

NewPGOManager creates a new PGO manager.

func (*PGOManager) GetOptimizedMessageType

func (m *PGOManager) GetOptimizedMessageType(fullName string) *hyperpb.MessageType

GetOptimizedMessageType returns the optimized message type if available, or nil.

func (*PGOManager) GetOrCreateProfile

func (m *PGOManager) GetOrCreateProfile(msgType *hyperpb.MessageType) *hyperpb.Profile

GetOrCreateProfile gets an existing profile or creates a new one for the message type.

func (*PGOManager) GetProfile

func (m *PGOManager) GetProfile(fullName string) *hyperpb.Profile

GetProfile returns the profile for the given message type, or nil if none exists.

func (*PGOManager) RecompileAll

func (m *PGOManager) RecompileAll() error

RecompileAll recompiles all message types with their collected profiles.

func (*PGOManager) RecompileWithProfile

func (m *PGOManager) RecompileWithProfile(fullName string) (*hyperpb.MessageType, error)

RecompileWithProfile recompiles the message type with its collected profile.

type SimpleCache

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

SimpleCache is a thread-safe cache for compiled message types.

func NewSimpleCache

func NewSimpleCache() *SimpleCache

NewSimpleCache creates a new simple cache.

func (*SimpleCache) Clear

func (c *SimpleCache) Clear()

Clear removes all entries from the cache.

func (*SimpleCache) Get

func (c *SimpleCache) Get(key string) (*hyperpb.MessageType, bool)

Get retrieves a message type from the cache.

func (*SimpleCache) Put

func (c *SimpleCache) Put(key string, msgType *hyperpb.MessageType)

Put stores a message type in the cache.

func (*SimpleCache) Size

func (c *SimpleCache) Size() int

Size returns the number of entries in the cache.

Jump to

Keyboard shortcuts

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