NAME
Protobuf::Internal - Internal XS functions and utilities
VERSION
version 0.04
SYNOPSIS
use Protobuf::Internal;
# Typically, the functions here are called by other Protobuf modules
# and not directly by end users.
DESCRIPTION
This module serves as the primary interface to the C/XS layer for the Protobuf distribution. It uses XSLoader to load functions implemented in C, which interact directly with the upb library.
Key functionalities provided through this module include:
Initializing the per-interpreter registry (
init_registry).Accessing and managing the object cache (
get_obj_cache,set_cache_capacity).Retrieving cache audit logs and contention statistics (
get_cache_audit_log,get_contention_stats).Core type conversion functions between Perl SVs and
upbtypes.
METHODS
Most functions in this module are not intended for public use. The following are called during initialization:
init_registry()
Called once when Protobuf is loaded to initialize the per-interpreter C-level registry, which holds the object cache, audit log, and other global states for the current Perl interpreter.
INTERNAL XS FUNCTIONS
The following functions are exposed from the XS layer but are for internal use by other Protobuf::* modules only:
class_name_to_full_nameclear_cachedelete_cache_entrydelete_cache_ptrfind_by_fingerprintfull_name_to_class_nameget_cache_audit_logget_cache_capacityget_contention_statsget_cpu_featuresget_fingerprintpreallocate_arenaregister_fingerprintset_cache_capacityset_chaos_enabledset_chaos_paramsclass_name_to_full_nameConverts a Perl class name (e.g.,
My::Package::Message) to a fully qualified protobuf message name (e.g.,my.package.Message).clear_cacheClears the internal object cache.
delete_cache_entryDeletes a specific entry from the object cache.
delete_cache_ptrDeletes a cache entry based on a pointer.
find_by_fingerprintFinds an object in the cache by its fingerprint.
full_name_to_class_nameConverts a fully qualified protobuf message name to a Perl class name.
get_cache_audit_logRetrieves the cache audit log.
get_cache_capacityGets the current capacity of the object cache.
get_contention_statsRetrieves cache contention statistics.
get_cpu_featuresDetects CPU features relevant to upb.
get_fingerprintGets the fingerprint for a given object.
preallocate_arenaPreallocates memory within an arena.
register_fingerprintRegisters an object's fingerprint in the cache.
set_cache_capacitySets the capacity of the object cache.
set_chaos_enabledEnables or disables chaos testing features.
set_chaos_paramsSets parameters for chaos testing.
verify_binary_diffVerifies binary differences between messages.
SEE ALSO
AUTHOR
C.J. Collier <cjac@google.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Google LLC.
This is free software; you can redistribute it and/or modify it under the terms of the BSD 3-Clause License.