NAME
Google::gRPC - High-performance gRPC client library for Perl over HTTP/2
VERSION
Version 0.10
SYNOPSIS
use Google::Auth;
use Google::gRPC::Client;
use Google::gRPC::ChannelPool;
my $auth = Google::Auth->default();
my $token = $auth->get_token();
# 1. Basic unary gRPC client
my $client = Google::gRPC::Client->new(
target => 'spanner.googleapis.com:443',
auth_token => $token,
timeout => 30,
max_retries => 3,
);
my $response = $client->call({
service => 'google.spanner.v1.Spanner',
method => 'CreateSession',
request => $request_msg,
response_class => 'Google::Cloud::Spanner::V1::Session',
});
# 2. Pooled multi-channel client for high-throughput services
my $pool = Google::gRPC::ChannelPool->new(
target => 'spanner.googleapis.com:443',
channels => 4,
);
my $pooled_client = Google::gRPC::Client->new(
channel_pool => $pool,
auth_token => $token,
);
DESCRIPTION
Google::gRPC is a Perl gRPC client library designed for Google Cloud APIs and general-purpose HTTP/2 gRPC services (comparable to Go's google.golang.org/grpc, Python's grpcio, Ruby's grpc, Java's grpc-java, and C++'s grpc++).
It provides:
Unary & Streaming RPCs: Full support for unary, server-streaming, client-streaming, and bidirectional-streaming RPCs via Google::gRPC::Client and Google::gRPC::Stream.
HTTP/2 Engines: Native C/XS
libnghttp2engine (Google::gRPC::Engine::NGHTTP2) with automatic fallback to Pure-Perl Protocol::HTTP2 (Google::gRPC::Engine::PP), plus Net::Curl::Easy for live unary calls.Deadlines, Retries & Keepalive: Automatic
grpc-timeoutdeadline formatting, exponential backoff retries on transient HTTP/gRPC errors (429/502/503/504 andUNAVAILABLE), and HTTP/2 keepalive pings.Channel Pooling: Multi-subchannel load balancing and response-byte tracking via Google::gRPC::ChannelPool.
Protobuf Integration: Seamless serialization/deserialization with Protobuf message classes and standard gRPC length-prefixed framing (Google::gRPC::Framing).
SUBMODULES
Google::gRPC::Client - High-level unary (
call) and streaming (stream) gRPC client with retries, auth headers, and deadlines.Google::gRPC::Server - HTTP/2 gRPC server supporting service/method registration, Protobuf framing, and AnyEvent TCP listeners.
Google::gRPC::Channel - Single HTTP/2 channel managing multiplexed gRPC streams and keepalive state.
Google::gRPC::ChannelPool - Pool of subchannels for connection reuse and load distribution.
Google::gRPC::Stream - Stream handle for sending and receiving framed gRPC messages and trailers.
Google::gRPC::Deadline - Parsing and formatting for
grpc-timeoutheaders.Google::gRPC::Status - Standard gRPC status codes and rich
grpc-status-details-binerror decoding.Google::gRPC::Framing - 5-byte gRPC length-prefixed frame packing/unpacking and trailer parsing.
Google::gRPC::Engine - Engine factory selecting
NGHTTP2(XS) orPP(Pure-Perl).
ENVIRONMENT VARIABLES
GOOGLE_CLOUD_QUOTA_PROJECT- Sent as thex-goog-user-projectmetadata header on RPC calls.PERL_GRPC_OFFLINE- Enables offline/in-memory channel execution for unit testing.
SEE ALSO
Google::Auth, Google::Api::Common, Protobuf, Module::Starter::Protobuf, https://grpc.io/docs/
SUPPORT AND BUG TRACKING
Report bugs or feature requests via GitHub:
https://github.com/GoogleCloudPlatform/google-auth-library-perl/issues
or CPAN RT:
https://rt.cpan.org/Dist/Display.html?Name=Google-gRPC
AUTHOR
C.J. Collier <cjac@google.com>
LICENSE
Apache License, Version 2.0