PHP Class Grpc\BaseStub

ファイルを表示 Open project: grpc/grpc Class Usage Examples

Public Methods

Method Description
__construct ( $hostname, $opts, $channel = null )
_bidiRequest ( string $method, callable $deserialize, array $metadata = [], $options = [] ) : grpc\BidiStreamingSurfaceActiveCall Call a remote method with messages streaming in both directions.
_clientStreamRequest ( string $method, callable $deserialize, array $metadata = [], $options = [] ) : grpc\ClientStreamingSurfaceActiveCall Call a remote method that takes a stream of arguments and has a single output.
_serverStreamRequest ( string $method, mixed $argument, callable $deserialize, array $metadata = [], $options = [] ) : grpc\ServerStreamingSurfaceActiveCall Call a remote method that takes a single argument and returns a stream of responses.
_simpleRequest ( string $method, mixed $argument, callable $deserialize, array $metadata = [], $options = [] ) : grpc\SimpleSurfaceActiveCall Call a remote method that takes a single argument and has a single output.
close ( ) Close the communication channel associated with this stub.
getConnectivityState ( $try_to_connect = false ) : integer
getTarget ( ) : string
waitForReady ( integer $timeout ) : boolean

Private Methods

Method Description
_checkConnectivityState ( $new_state )
_get_jwt_aud_uri ( $method ) constructs the auth uri for the jwt.
_validate_and_normalize_metadata ( array $metadata ) validate and normalize the metadata array.

Method Details

__construct() public method

public __construct ( $hostname, $opts, $channel = null )
$hostname string
$opts array - '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

_bidiRequest() public method

Call a remote method with messages streaming in both directions.
public _bidiRequest ( string $method, callable $deserialize, array $metadata = [], $options = [] ) : grpc\BidiStreamingSurfaceActiveCall
$method string The name of the method to call
$deserialize callable A function that deserializes the responses
$metadata array A metadata map to send to the server
return grpc\BidiStreamingSurfaceActiveCall The active call object

_clientStreamRequest() public method

Call a remote method that takes a stream of arguments and has a single output.
public _clientStreamRequest ( string $method, callable $deserialize, array $metadata = [], $options = [] ) : grpc\ClientStreamingSurfaceActiveCall
$method string The name of the method to call
$deserialize callable A function that deserializes the response
$metadata array A metadata map to send to the server
return grpc\ClientStreamingSurfaceActiveCall The active call object

_serverStreamRequest() public method

Call a remote method that takes a single argument and returns a stream of responses.
public _serverStreamRequest ( string $method, mixed $argument, callable $deserialize, array $metadata = [], $options = [] ) : grpc\ServerStreamingSurfaceActiveCall
$method string The name of the method to call
$argument mixed The argument to the method
$deserialize callable A function that deserializes the responses
$metadata array A metadata map to send to the server
return grpc\ServerStreamingSurfaceActiveCall The active call object

_simpleRequest() public method

Call a remote method that takes a single argument and has a single output.
public _simpleRequest ( string $method, mixed $argument, callable $deserialize, array $metadata = [], $options = [] ) : grpc\SimpleSurfaceActiveCall
$method string The name of the method to call
$argument mixed The argument to the method
$deserialize callable A function that deserializes the response
$metadata array A metadata map to send to the server
return grpc\SimpleSurfaceActiveCall The active call object

close() public method

Close the communication channel associated with this stub.
public close ( )

getConnectivityState() public method

public getConnectivityState ( $try_to_connect = false ) : integer
$try_to_connect bool
return integer The grpc connectivity state

getTarget() public method

public getTarget ( ) : string
return string The URI of the endpoint.

waitForReady() public method

public waitForReady ( integer $timeout ) : boolean
$timeout integer in microseconds
return boolean true if channel is ready