QAbstractGrpcChannel Class

The QAbstractGrpcChannel class is an interface that represents common gRPC channel functionality. More...

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

QGrpcHttp2Channel

Status: Technical Preview

Public Functions

void addInterceptorManager(const QGrpcClientInterceptorManager &manager)
virtual std::shared_ptr<QAbstractProtobufSerializer> serializer() const = 0

Protected Functions

(since 6.7) virtual void call(std::shared_ptr<QGrpcChannelOperation> channelOperation) = 0
(since 6.7) virtual void startBidirStream(std::shared_ptr<QGrpcChannelOperation> channelOperation) = 0
(since 6.7) virtual void startClientStream(std::shared_ptr<QGrpcChannelOperation> channelOperation) = 0
(since 6.7) virtual void startServerStream(std::shared_ptr<QGrpcChannelOperation> channelOperation) = 0

Detailed Description

Implement this interface to create your own custom channel for gRPC transportation. We provide the QGrpcHttp2Channel, which is a fully featured implementation of the QAbstractGrpcChannel for HTTP/2 communication.

Member Function Documentation

void QAbstractGrpcChannel::addInterceptorManager(const QGrpcClientInterceptorManager &manager)

Sets the interceptor manager for the channel.

[pure virtual protected, since 6.7] void QAbstractGrpcChannel::call(std::shared_ptr<QGrpcChannelOperation> channelOperation)

This pure virtual function is called by public QAbstractGrpcChannel::call method when making unary gRPC call. The channelOperation is the pointer to a channel side QGrpcChannelOperation primitive that is connected with QGrpcCallReply primitive, that is used in QAbstractGrpcClient implementations.

The function should implement the channel-side logic of unary call. The implementation must be asynchronous and must not block the thread where the function was called.

This function was introduced in Qt 6.7.

[pure virtual noexcept] 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 protected, since 6.7] void QAbstractGrpcChannel::startBidirStream(std::shared_ptr<QGrpcChannelOperation> channelOperation)

This pure virtual function that the starts of the bidirectional stream. The channelOperation is the pointer to a channel side QGrpcChannelOperation primitive that is connected with QGrpcBidirStream primitive, that is used in QAbstractGrpcClient.

The function should implement the channel-side logic of bidirectional stream. The implementation must be asynchronous and must not block the thread where the function was called.

This function was introduced in Qt 6.7.

[pure virtual protected, since 6.7] void QAbstractGrpcChannel::startClientStream(std::shared_ptr<QGrpcChannelOperation> channelOperation)

This pure virtual function that the starts of the client-side stream. The channelOperation is the pointer to a channel side QGrpcChannelOperation primitive that is connected with QGrpcClientStream primitive, that is used in QAbstractGrpcClient.

The function should implement the channel-side logic of client-side stream. The implementation must be asynchronous and must not block the thread where the function was called.

This function was introduced in Qt 6.7.

[pure virtual protected, since 6.7] void QAbstractGrpcChannel::startServerStream(std::shared_ptr<QGrpcChannelOperation> channelOperation)

This pure virtual function that the starts of the server-side stream. The channelOperation is the pointer to a channel side QGrpcChannelOperation primitive that is connected with QGrpcServerStream primitive, that is used in QAbstractGrpcClient implementations.

The function should implement the channel-side logic of server-side stream. The implementation must be asynchronous and must not block the thread where the function was called.

This function was introduced in Qt 6.7.