-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDK 2.7.0-beta #367
SDK 2.7.0-beta #367
Changes from 107 commits
89758d2
8e9fe86
1c8bb1d
30556c6
d90652d
a86afa1
8174f00
2df471a
883f257
686be6b
f32a347
fcc6f77
40628f8
9ec8c60
d0260df
6ccb3f4
1a76081
672ab8b
83b4e8d
1238ddf
fb31547
7da53f3
9640427
5cca0a7
bb2ac80
af60b07
4695023
27e60ac
a1e1edc
9365d52
fbe5532
bac885c
2abf7a0
2b69c28
b978181
39a42ac
4aa3370
767c1d6
9867e6d
6256c95
5a513bb
ec0021a
e56bffa
f90632e
e942a6b
0b94e40
63be296
ad87421
998292e
6f2cbb5
361d733
70cb4a2
b7b9394
4a3edc7
9759da3
565f48f
bc6e9ac
8f8dc90
3e52abf
133fd82
2655949
5ba42c7
a3b8984
e5bb80b
52cd3a4
b02d1ce
24626f9
0107bff
cd18a43
fae2573
329b987
73047f7
e54347d
0ef7fad
a70f026
f9c4dc7
5ec078c
6bffa28
1360ca7
d4eab96
39dd4db
90eb63b
64530da
12b8fac
25d93c6
9d8937f
3c00c06
b3610cc
a1a382a
2f2c224
bb9880e
3a17811
097cf12
3c12a2d
693e431
784056e
a654a87
351514f
25286ab
9980fa6
0f63cd2
f3c0a33
28affbc
5ef06ca
b5a52f0
24c4fc7
5f4f868
3f5340c
647b6fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of Temporal package. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Temporal\Client\Interceptor; | ||
|
||
use Temporal\Api\Workflowservice\V1\GetSystemInfoRequest; | ||
use Temporal\Client\GRPC\ContextInterface; | ||
use Temporal\Client\GRPC\ServiceClient; | ||
use Temporal\Client\GRPC\StatusCode; | ||
use Temporal\Client\ServerCapabilities; | ||
use Temporal\Exception\Client\ServiceClientException; | ||
use Temporal\Interceptor\GrpcClientInterceptor; | ||
|
||
/** | ||
* @psalm-immutable | ||
*/ | ||
final class SystemInfoInterceptor implements GrpcClientInterceptor | ||
{ | ||
private bool $systemInfoRequested = false; | ||
|
||
public function __construct( | ||
private ServiceClient $serviceClient | ||
) { | ||
} | ||
|
||
/** | ||
* @param non-empty-string $method | ||
* @param callable(non-empty-string, object, ContextInterface): object $next | ||
*/ | ||
public function interceptCall(string $method, object $arg, ContextInterface $ctx, callable $next): object | ||
{ | ||
if ($this->systemInfoRequested) { | ||
return $next($method, $arg, $ctx); | ||
Check failure on line 41 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureFunctionCall
Check failure on line 41 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureFunctionCall
|
||
} | ||
|
||
try { | ||
$systemInfo = $this->serviceClient->getSystemInfo(new GetSystemInfoRequest()); | ||
Check failure on line 45 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureMethodCall
Check failure on line 45 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureMethodCall
|
||
|
||
$capabilities = $systemInfo->getCapabilities(); | ||
Check failure on line 47 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureMethodCall
Check failure on line 47 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureMethodCall
|
||
if ($capabilities !== null && $this->serviceClient->getServerCapabilities() === null) { | ||
$this->serviceClient->setServerCapabilities(new ServerCapabilities( | ||
Check failure on line 49 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureMethodCall
Check failure on line 49 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureMethodCall
|
||
signalAndQueryHeader: $capabilities->getSignalAndQueryHeader(), | ||
Check failure on line 50 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureMethodCall
Check failure on line 50 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureMethodCall
|
||
internalErrorDifferentiation: $capabilities->getInternalErrorDifferentiation() | ||
Check failure on line 51 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureMethodCall
Check failure on line 51 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureMethodCall
|
||
)); | ||
} | ||
} catch (ServiceClientException $e) { | ||
if ($e->getCode() !== StatusCode::UNIMPLEMENTED) { | ||
throw $e; | ||
} | ||
} | ||
|
||
$this->systemInfoRequested = true; | ||
Check failure on line 60 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)InaccessibleProperty
Check failure on line 60 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)InaccessibleProperty
|
||
|
||
return $next($method, $arg, $ctx); | ||
Check failure on line 62 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureFunctionCall
Check failure on line 62 in src/Client/Interceptor/SystemInfoInterceptor.php GitHub Actions / Psalm Validation (PHP 8.2, OS ubuntu-latest)ImpureFunctionCall
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of Temporal package. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Temporal\Client; | ||
|
||
final class ServerCapabilities | ||
{ | ||
public function __construct( | ||
private bool $signalAndQueryHeader = false, | ||
private bool $internalErrorDifferentiation = false | ||
) { | ||
} | ||
|
||
/** | ||
* True if signal and query headers are supported. | ||
*/ | ||
public function isSignalAndQueryHeaderSupports(): bool | ||
{ | ||
return $this->signalAndQueryHeader; | ||
} | ||
|
||
/** | ||
* True if internal errors are differentiated from other types of errors for purposes of | ||
* retrying non-internal errors. | ||
* When unset/false, clients retry all failures. When true, clients should only retry | ||
* non-internal errors. | ||
*/ | ||
public function isInternalErrorDifferentiation(): bool | ||
{ | ||
return $this->internalErrorDifferentiation; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be resolved in a separated PR