class GrpcTransport extends BaseStub implements TransportInterface (View source)

A gRPC based transport implementation.

Traits

Provides helper methods for gRPC support.
Provides helper methods for service address handling.

Methods

static array
validate(array $arr, array $requiredKeys)

No description

static array
validateNotNull(array $arr, array $requiredKeys)

No description

__construct(string $hostname, array $opts, Channel $channel = null, array $interceptors = [])

No description

static GrpcTransport
build(string $apiEndpoint, array $config = [])

Builds a GrpcTransport.

BidiStream
startBidiStreamingCall(Call $call, array $options)

Starts a bidi streaming call.

ClientStream
startClientStreamingCall(Call $call, array $options)

Starts a client streaming call.

ServerStream
startServerStreamingCall(Call $call, array $options)

Starts a server streaming call.

PromiseInterface
startUnaryCall(Call $call, array $options)

Returns a promise used to execute network requests.

Details

static array validate(array $arr, array $requiredKeys)

Parameters

array $arr Associative array
array $requiredKeys List of keys to check for in $arr

Return Value

array Returns $arr for fluent use

static array validateNotNull(array $arr, array $requiredKeys)

Parameters

array $arr Associative array
array $requiredKeys List of keys to check for in $arr

Return Value

array Returns $arr for fluent use

__construct(string $hostname, array $opts, Channel $channel = null, array $interceptors = [])

Parameters

string $hostname
array $opts
  • 'update_metadata': (optional) a callback function which takes in a metadata array, and returns an updated metadata array
    • 'grpc.primary_user_agent': (optional) a user-agent string
Channel $channel An already created Channel object (optional)
array $interceptors EXPERIMENTAL Interceptors used to intercept RPC invocations before a call starts. Please note that implementations of {see \Google\ApiCore\Transport\Grpc\UnaryInterceptorInterface} are considered deprecated and support will be removed in a future release. To prepare for this, please take the time to convert UnaryInterceptorInterface implementations over to a class which extends {see \Grpc\Interceptor}.

Exceptions

Exception

static GrpcTransport build(string $apiEndpoint, array $config = [])

Builds a GrpcTransport.

Parameters

string $apiEndpoint The address of the API remote host, for example "example.googleapis.com. May also include the port, for example "example.googleapis.com:443"
array $config { Config options used to construct the gRPC transport.

@type array $stubOpts Options used to construct the gRPC stub. @type Channel $channel Grpc channel to be used. @type Interceptor[]|UnaryInterceptorInterface[] $interceptors EXPERIMENTAL Interceptors used to intercept RPC invocations before a call starts. Please note that implementations of {see \Google\ApiCore\Transport\Grpc\UnaryInterceptorInterface} are considered deprecated and support will be removed in a future release. To prepare for this, please take the time to convert UnaryInterceptorInterface implementations over to a class which extends {see \Grpc\Interceptor}. }

Return Value

GrpcTransport

Exceptions

ValidationException

BidiStream startBidiStreamingCall(Call $call, array $options)

Starts a bidi streaming call.

Parameters

Call $call
array $options

Return Value

BidiStream

ClientStream startClientStreamingCall(Call $call, array $options)

Starts a client streaming call.

Parameters

Call $call
array $options

Return Value

ClientStream

ServerStream startServerStreamingCall(Call $call, array $options)

Starts a server streaming call.

Parameters

Call $call
array $options

Return Value

ServerStream

PromiseInterface startUnaryCall(Call $call, array $options)

Returns a promise used to execute network requests.

Parameters

Call $call
array $options

Return Value

PromiseInterface

Exceptions

ValidationException