Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Gax/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"require": {
"php": "^8.2",
"google/auth": "^1.53",
"google/grpc-gcp": "^0.4",
"grpc/grpc": "^1.38",
"google/protobuf": "^4.31||^5.34",
"guzzlehttp/promises": "^2.0.3||^3.0",
Expand Down
37 changes: 3 additions & 34 deletions Gax/src/ClientOptionsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
use Google\Auth\FetchAuthTokenInterface;
use Google\Auth\GetUniverseDomainInterface;
use Google\Auth\HttpHandler\HttpHandlerFactory;
use Grpc\Gcp\ApiConfig;
use Grpc\Gcp\Config;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;

Expand All @@ -65,14 +63,6 @@ private static function getGapicVersion(array $options)
return self::$gapicVersionFromFile;
}

private static function initGrpcGcpConfig(string $hostName, string $confPath)
{
$apiConfig = new ApiConfig();
$apiConfig->mergeFromJsonString(file_get_contents($confPath));
$config = new Config($hostName, $apiConfig);
return $config;
}

/**
* Get default options. This function should be "overridden" by clients using late static
* binding to provide default options to the client.
Expand All @@ -93,11 +83,9 @@ private static function getClientDefaults()
* 1. Set default client option values
* 2. Set default logger (and log user-supplied configuration options)
* 3. Set default transport configuration
* 4. Call "modifyClientOptions" (for backwards compatibility)
* 5. Use "defaultScopes" when custom endpoint is supplied
* 6. Load mTLS from the environment if configured
* 7. Resolve endpoint based on universe domain template when possible
* 8. Load sysvshm grpc config when possible
* 4. Use "defaultScopes" when custom endpoint is supplied
* 5. Load mTLS from the environment if configured
* 6. Resolve endpoint based on universe domain template when possible
*/
private function buildClientOptions(array|ClientOptions $options)
{
Expand Down Expand Up @@ -253,25 +241,6 @@ private function buildClientOptions(array|ClientOptions $options)
}
}

if (extension_loaded('sysvshm')
&& isset($options['gcpApiConfigPath'])
&& file_exists($options['gcpApiConfigPath'])
&& !empty($apiEndpoint)
) {
$grpcGcpConfig = self::initGrpcGcpConfig(
$apiEndpoint,
$options['gcpApiConfigPath']
);

if (!array_key_exists('stubOpts', $options['transportConfig']['grpc'])) {
$options['transportConfig']['grpc']['stubOpts'] = [];
}

$options['transportConfig']['grpc']['stubOpts'] += [
'grpc_call_invoker' => $grpcGcpConfig->callInvoker()
];
}

$options['apiEndpoint'] = $apiEndpoint;

return $options;
Expand Down
5 changes: 2 additions & 3 deletions Gax/src/Transport/Grpc/ServerStreamingCallWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
namespace Google\ApiCore\Transport\Grpc;

use Google\ApiCore\ServerStreamingCallInterface;
use Grpc\Gcp\GCPServerStreamCall;
use Grpc\ServerStreamingCall;

/**
Expand All @@ -43,12 +42,12 @@
class ServerStreamingCallWrapper implements ServerStreamingCallInterface
{
/**
* @var ServerStreamingCall|GCPServerStreamCall
* @var ServerStreamingCall
*/
private object $stream;

/**
* @param ServerStreamingCall|GCPServerStreamCall $stream
* @param ServerStreamingCall $stream
*/
public function __construct($stream)
{
Expand Down
11 changes: 0 additions & 11 deletions Gax/tests/Unit/ClientOptionsTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
use Google\Auth\FetchAuthTokenInterface;
use Google\Auth\GetUniverseDomainInterface;
use Google\Auth\Logging\StdOutLogger;
use Grpc\Gcp\ApiConfig;
use Grpc\Gcp\Config;
use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
Expand Down Expand Up @@ -84,7 +82,6 @@ public static function getClientDefaults()
{
return [
'apiEndpoint' => 'test.address.com:443',
'gcpApiConfigPath' => __DIR__ . '/testdata/resources/test_service_grpc_config.json',
];
}
};
Expand Down Expand Up @@ -242,21 +239,13 @@ public function testBuildClientOptions($options, $expectedUpdatedOptions)

public function buildClientOptionsProvider()
{
$apiConfig = new ApiConfig();
$apiConfig->mergeFromJsonString(
file_get_contents(__DIR__ . '/testdata/resources/test_service_grpc_config.json')
);
$grpcGcpConfig = new Config('test.address.com:443', $apiConfig);

$defaultOptions = [
'apiEndpoint' => 'test.address.com:443',
'gcpApiConfigPath' => __DIR__ . '/testdata/resources/test_service_grpc_config.json',
'disableRetries' => false,
'transport' => null,
'transportConfig' => [
'grpc' => [
'stubOpts' => [
'grpc_call_invoker' => $grpcGcpConfig->callInvoker(),
'grpc.service_config_disable_resolution' => 1,
],
'logger' => null,
Expand Down
1 change: 0 additions & 1 deletion Gax/tests/Unit/GapicClientTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
use Google\LongRunning\Client\OperationsClient;
use Google\LongRunning\GetOperationRequest;
use Google\LongRunning\Operation;
use Grpc\Gcp\Config;
use GuzzleHttp\Promise\FulfilledPromise;
use GuzzleHttp\Promise\PromiseInterface;
use PHPUnit\Framework\TestCase;
Expand Down
17 changes: 0 additions & 17 deletions Gax/tests/Unit/testdata/resources/test_service_grpc_config.json

This file was deleted.

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
"grpc/grpc": "^1.13",
"google/common-protos": "^4.4",
"google/protobuf": "^4.31||^5.34",
"google/grpc-gcp": "^0.4",
"ramsey/uuid": "^4.0",
"open-telemetry/sdk": "^1.13",
"open-telemetry/exporter-otlp": "^1.4"
Expand Down
Loading