The QAbstractGrpcChannel class is interface that represents common gRPC channel functionality. 更多...
头: | #include <QAbstractGrpcChannel> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc) |
Since: | Qt 6.5 |
继承者: | |
Status: | Technical Preview |
virtual QGrpcStatus | call (QLatin1StringView method , QLatin1StringView service , QByteArrayView args , QByteArray & ret , const QGrpcCallOptions & options = QGrpcCallOptions()) = 0 |
virtual std::shared_ptr<QGrpcCallReply> | call (QLatin1StringView method , QLatin1StringView service , QByteArrayView args , const QGrpcCallOptions & options = QGrpcCallOptions()) = 0 |
virtual std::shared_ptr<QAbstractProtobufSerializer> | serializer () const = 0 |
virtual std::shared_ptr<QGrpcStream> | startStream (QLatin1StringView method , QLatin1StringView service , QByteArrayView arg , const QGrpcCallOptions & options = QGrpcCallOptions()) = 0 |
You may implement this interface to create your own channels for gRPC transport. QGrpcChannel or QGrpcHttp2Channel , which are full implementations of QAbstractGrpcChannel are recommended to use.
[pure virtual]
QGrpcStatus
QAbstractGrpcChannel::
call
(
QLatin1StringView
method
,
QLatin1StringView
service
,
QByteArrayView
args
,
QByteArray
&
ret
, const
QGrpcCallOptions
&
options
= QGrpcCallOptions())
This pure virtual function synchronously calls the RPC method concatenated from the method and service parameters with the given args and writes the result to the output parameter ret . Uses options argument to set additional parameter for the call.
You may reimplement this function in a subclass to define your own call mechanism behavior. QGrpcChannel or QGrpcHttp2Channel , which are full implementations of QAbstractGrpcChannel are recommended to use.
[pure virtual]
std::shared_ptr
<
QGrpcCallReply
> QAbstractGrpcChannel::
call
(
QLatin1StringView
method
,
QLatin1StringView
service
,
QByteArrayView
args
, const
QGrpcCallOptions
&
options
= QGrpcCallOptions())
This pure virtual function asynchronously calls the RPC method combined with the method and service parameters with the given args and returns an asynchronous response in the form of QGrpcCallReply . Uses options argument to set additional parameter for the call.
You may reimplement this function in a subclass to define your own call mechanism behavior. QGrpcChannel or QGrpcHttp2Channel , which are full implementations of QAbstractGrpcChannel are recommended to use.
[pure virtual]
std::shared_ptr
<
QAbstractProtobufSerializer
> QAbstractGrpcChannel::
serializer
() const
This pure virtual function shall return a shared pointer to QAbstractProtobufSerializer .
This function is called to obtain the QAbstractProtobufSerializer used to perform serialization and deserialization of the message.
[pure virtual]
std::shared_ptr
<
QGrpcStream
> QAbstractGrpcChannel::
startStream
(
QLatin1StringView
method
,
QLatin1StringView
service
,
QByteArrayView
arg
, const
QGrpcCallOptions
&
options
= QGrpcCallOptions())
This pure virtual function creates and starts a stream to the RPC method.
The RPC method name is constructed by concatenating the method and service parameters and called with the arg argument. Returns a shared pointer to the QGrpcStream . Uses options argument to set additional parameter for the stream.
You may reimplement this function in a subclass to define your own stream mechanism behavior. QGrpcChannel or QGrpcHttp2Channel , which are full implementations of QAbstractGrpcChannel are recommended to use.