QGrpcChannel Class

The QGrpcChannel class is a gRPC-cpp native api implementation of QAbstractGrpcChannel interface. More...

Header: #include <QGrpcChannel>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.5
Inherits: QAbstractGrpcChannel

Public Functions

QGrpcChannel(const QUrl &url, QGrpcChannel::NativeGrpcChannelCredentials credentialsType, const QStringList &credentialsList)
QGrpcChannel(const QUrl &url, QGrpcChannel::NativeGrpcChannelCredentials credentialsType)
virtual ~QGrpcChannel() override

Reimplemented Public Functions

virtual QGrpcStatus call(QLatin1StringView method, QLatin1StringView service, QByteArrayView args, QByteArray &ret) override
virtual std::shared_ptr<QGrpcCallReply> call(QAbstractGrpcClient *client, QLatin1StringView method, QLatin1StringView service, QByteArrayView args) override
virtual std::shared_ptr<QAbstractProtobufSerializer> serializer() const override
virtual void startStream(QGrpcStream *stream, QLatin1StringView service) override

Detailed Description

QGrpcChannel accepts the same grpc::ChannelCredentials type that is required by native-api grpc::CreateChannel.

See also gRPC ChannelCredentials.

Member Function Documentation

[explicit] QGrpcChannel::QGrpcChannel(const QUrl &url, QGrpcChannel::NativeGrpcChannelCredentials credentialsType, const QStringList &credentialsList)

Constructs a gRPC channel, with url, credentialsType, and credentialsList object.

[explicit] QGrpcChannel::QGrpcChannel(const QUrl &url, QGrpcChannel::NativeGrpcChannelCredentials credentialsType)

Constructs a gRPC channel, with url, credentialsType and an empty credentials list.

[override virtual] QGrpcChannel::~QGrpcChannel()

Destroys the QGrpcChannel object.

[override virtual] QGrpcStatus QGrpcChannel::call(QLatin1StringView method, QLatin1StringView service, QByteArrayView args, QByteArray &ret)

Reimplements: QAbstractGrpcChannel::call(QLatin1StringView method, QLatin1StringView service, QByteArrayView args, QByteArray &ret).

Synchronously calls the RPC method and writes the result to the output parameter ret.

The RPC method name is concatenated from the method and service parameters with the given args.

[override virtual] std::shared_ptr<QGrpcCallReply> QGrpcChannel::call(QAbstractGrpcClient *client, QLatin1StringView method, QLatin1StringView service, QByteArrayView args)

Reimplements: QAbstractGrpcChannel::call(QAbstractGrpcClient *client, QLatin1StringView method, QLatin1StringView service, QByteArrayView args).

Asynchronously calls the RPC method.

The RPC method name is concatenated from the method and service parameters with the given args. The method can emit QGrpcCallReply::finished() and QGrpcCallReply::errorOccurred() signals on a QGrpcCallReply returned object.

[override virtual] std::shared_ptr<QAbstractProtobufSerializer> QGrpcChannel::serializer() const

Reimplements: QAbstractGrpcChannel::serializer() const.

Returns the newly created QProtobufSerializer shared pointer.

[override virtual] void QGrpcChannel::startStream(QGrpcStream *stream, QLatin1StringView service)

Reimplements: QAbstractGrpcChannel::startStream(QGrpcStream *stream, QLatin1StringView service).

Starts a stream on a stream using QGrpcStream::method() and the service to get the name of the RPC method.

Calls QGrpcStream::handler() when the stream receives data from the server. The method may emit QGrpcStream::errorOccurred() when the stream has terminated with an error.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.