Documentation
¶
Overview ¶
Package proto provides internal protobuf compilation utilities.
Package proto provides internal protobuf compilation utilities.
Index ¶
- Variables
- func CompileMessageType(md protoreflect.MessageDescriptor) (*hyperpb.MessageType, error)
- func CompileMessageTypeWithCache(md protoreflect.MessageDescriptor, cache MessageTypeCache) (*hyperpb.MessageType, error)
- func CompileMessageTypeWithOptions(md protoreflect.MessageDescriptor, opts []hyperpb.CompileOption) (*hyperpb.MessageType, error)
- func CompileWithPGO(md protoreflect.MessageDescriptor, pgoManager *PGOManager) (*hyperpb.MessageType, error)
- type MessageTypeCache
- type PGOManager
- func (m *PGOManager) GetOptimizedMessageType(fullName string) *hyperpb.MessageType
- func (m *PGOManager) GetOrCreateProfile(msgType *hyperpb.MessageType) *hyperpb.Profile
- func (m *PGOManager) GetProfile(fullName string) *hyperpb.Profile
- func (m *PGOManager) RecompileAll() error
- func (m *PGOManager) RecompileWithProfile(fullName string) (*hyperpb.MessageType, error)
- type SimpleCache
Constants ¶
This section is empty.
Variables ¶
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 (*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 (*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.