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

virtual std::shared_ptr<QAbstractProtobufSerializer> serializer() const = 0

Protected Functions

(since 6.7) virtual void call(std::shared_ptr<QGrpcOperationContext> operationContext) = 0
(since 6.7) virtual void startBidiStream(std::shared_ptr<QGrpcOperationContext> operationContext) = 0
(since 6.7) virtual void startClientStream(std::shared_ptr<QGrpcOperationContext> operationContext) = 0
(since 6.7) virtual void startServerStream(std::shared_ptr<QGrpcOperationContext> operationContext) = 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

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

This pure virtual function is called by public QAbstractGrpcChannel::call method when making unary gRPC call. The operationContext is the pointer to a channel side QGrpcOperationContext primitive that is connected with QGrpcCallReply primitive, that is used in QGrpcClientBase 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::startBidiStream(std::shared_ptr<QGrpcOperationContext> operationContext)

This pure virtual function that the starts of the bidirectional stream. The operationContext is the pointer to a channel side QGrpcOperationContext primitive that is connected with QGrpcBidiStream primitive, that is used in QGrpcClientBase.

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<QGrpcOperationContext> operationContext)

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

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<QGrpcOperationContext> operationContext)

This pure virtual function that the starts of the server-side stream. The operationContext is the pointer to a channel side QGrpcOperationContext primitive that is connected with QGrpcServerStream primitive, that is used in QGrpcClientBase 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.