QGrpcChannelOperation Class

The QGrpcChannelOperation class implements common logic to handle the gRPC communication from the channel side. More...

Header: #include <QGrpcChannelOperation>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.7
Inherits: QObject
Status: Technical Preview

Public Functions

QByteArrayView argument() const
QLatin1StringView method() const
const QGrpcCallOptions &options() const
std::shared_ptr<const QAbstractProtobufSerializer> serializer() const
const QGrpcMetadata &serverMetadata() const
QLatin1StringView service() const
void setArgument(QByteArrayView arg)
void setClientMetadata(const QGrpcMetadata &metadata)
void setClientMetadata(QGrpcMetadata &&metadata)
void setOptions(QGrpcCallOptions &options)
void setServerMetadata(const QGrpcMetadata &metadata)
void setServerMetadata(QGrpcMetadata &&metadata)

Signals

void dataReady(const QByteArray &data)
void sendData(const QByteArray &data) const

Detailed Description

Member Function Documentation

[noexcept] QByteArrayView QGrpcChannelOperation::argument() const

Returns the serialized arguments that are used for this operation.

See also setArgument().

[signal] void QGrpcChannelOperation::dataReady(const QByteArray &data)

The signal should be emitted by the channel when the new chunk of data is received.

For client streams and unary calls, this means that the response is received from the server, and communication will be successfully finished. For server and bidir streams this signal should be called by channel to signalize that receiving of new message is completed and user business logic now can process it at the client side.

The signal is implicitly connected to the QGrpcOperation counterpart.

[noexcept] QLatin1StringView QGrpcChannelOperation::method() const

Returns the method name that is assigned to this operation.

[noexcept] const QGrpcCallOptions &QGrpcChannelOperation::options() const

Return the options that are assigned to this operation.

See also setOptions().

[signal] void QGrpcChannelOperation::sendData(const QByteArray &data) const

The signal is emitted when the client tries to send a new message to the channel.

This signal can only be emitted by client or bidir streams. Implementations of QAbstractGrpcChannel should connect the sending logic to this signal. The data should be wrapped with the channel-related headers and sent to the wire.

The signal is implicitly connected to the QGrpcOperation counterpart.

[noexcept] std::shared_ptr<const QAbstractProtobufSerializer> QGrpcChannelOperation::serializer() const

Return the serializer that is assigned to this operation.

[noexcept] const QGrpcMetadata &QGrpcChannelOperation::serverMetadata() const

Returns the metadata that is received from server.

The method is used implicitly by QGrpcOperation counterpart.

See also setServerMetadata().

[noexcept] QLatin1StringView QGrpcChannelOperation::service() const

Returns the service name that is assigned to this operation.

void QGrpcChannelOperation::setArgument(QByteArrayView arg)

Updates the arg attribute that will be used for this operation.

The method expects arg to be serialized data.

See also argument().

void QGrpcChannelOperation::setClientMetadata(const QGrpcMetadata &metadata)

Updates client metadata in the QGrpcCallOptions attribute.

The metadata then can be processed on the server side.

void QGrpcChannelOperation::setClientMetadata(QGrpcMetadata &&metadata)

Updates client metadata in the QGrpcCallOptions attribute.

The metadata then can be processed on the server side.

void QGrpcChannelOperation::setOptions(QGrpcCallOptions &options)

Updates the call options attribute.

See also options().

void QGrpcChannelOperation::setServerMetadata(const QGrpcMetadata &metadata)

Stores the recently received server metadata.

The metadata then can be processed on the client side.

See also serverMetadata().

void QGrpcChannelOperation::setServerMetadata(QGrpcMetadata &&metadata)

Stores the recently received server metadata.

The metadata then can be processed on the client side.