The QGrpcChannel class is a gRPC-cpp native api implementation of QAbstractGrpcChannel 接口。 更多...
头: | #include <QGrpcChannel> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc) |
Since: | Qt 6.5 |
继承: | QAbstractGrpcChannel |
Status: | Technical Preview |
QGrpcChannel (const QGrpcChannelOptions & options , QGrpcChannel::NativeGrpcChannelCredentials credentialsType ) | |
virtual | ~QGrpcChannel () override |
virtual QGrpcStatus | call (QLatin1StringView method , QLatin1StringView service , QByteArrayView args , QByteArray & ret , const QGrpcCallOptions & options = QGrpcCallOptions()) override |
virtual std::shared_ptr<QGrpcCallReply> | call (QLatin1StringView method , QLatin1StringView service , QByteArrayView args , const QGrpcCallOptions & options = QGrpcCallOptions()) override |
virtual std::shared_ptr<QAbstractProtobufSerializer> | serializer () const override |
virtual std::shared_ptr<QGrpcStream> | startStream (QLatin1StringView method , QLatin1StringView service , QByteArrayView arg , const QGrpcCallOptions & options = QGrpcCallOptions()) override |
QGrpcChannel accepts the same grpc::ChannelCredentials type that is required by native-api grpc::CreateChannel.
另请参阅 gRPC ChannelCredentials .
[explicit]
QGrpcChannel::
QGrpcChannel
(const
QGrpcChannelOptions
&
options
,
QGrpcChannel::NativeGrpcChannelCredentials
credentialsType
)
Constructs a gRPC channel, with options and credentialsType .
[override virtual noexcept]
QGrpcChannel::
~QGrpcChannel
()
销毁 QGrpcChannel 对象。
[override virtual]
QGrpcStatus
QGrpcChannel::
call
(
QLatin1StringView
method
,
QLatin1StringView
service
,
QByteArrayView
args
,
QByteArray
&
ret
, const
QGrpcCallOptions
&
options
= QGrpcCallOptions())
重实现: QAbstractGrpcChannel::call (QLatin1StringView method, QLatin1StringView service, QByteArrayView args, QByteArray &ret, const QGrpcCallOptions &options).
Synchronously calls the RPC method and writes the result to the output parameter ret .
The RPC method name is constructed by concatenating the method and service parameters and called with the args argument. Uses options argument to set additional parameter for the call.
[override virtual]
std::shared_ptr
<
QGrpcCallReply
> QGrpcChannel::
call
(
QLatin1StringView
method
,
QLatin1StringView
service
,
QByteArrayView
args
, const
QGrpcCallOptions
&
options
= QGrpcCallOptions())
重实现: QAbstractGrpcChannel::call (QLatin1StringView method, QLatin1StringView service, QByteArrayView args, const QGrpcCallOptions &options).
Asynchronously calls the RPC method.
The RPC method name is constructed by concatenating the method and service parameters and called with the args argument. Uses options argument to set additional parameter for the call. The method can emit QGrpcCallReply::finished () 和 QGrpcCallReply::errorOccurred () signals on a QGrpcCallReply returned object.
[override virtual]
std::shared_ptr
<
QAbstractProtobufSerializer
> QGrpcChannel::
serializer
() const
重实现: QAbstractGrpcChannel::serializer() const .
返回新近创建的 QProtobufSerializer shared pointer.
[override virtual]
std::shared_ptr
<
QGrpcStream
> QGrpcChannel::
startStream
(
QLatin1StringView
method
,
QLatin1StringView
service
,
QByteArrayView
arg
, const
QGrpcCallOptions
&
options
= QGrpcCallOptions())
重实现: QAbstractGrpcChannel::startStream (QLatin1StringView method, QLatin1StringView service, QByteArrayView arg, const QGrpcCallOptions &options).
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.
调用 QGrpcStream::updateData () when the stream receives data from the server. The method may emit QGrpcStream::errorOccurred () when the stream has terminated with an error.