QGrpcChannelOperation Class | Qt GRPC 6.8.0
Description: The QGrpcChannelOperation class implements common logic to handle the gRPC communication from the channel side.

- Qt 6.8
- Qt GRPC
- C++ Classes
- QtGrpc (Technical Preview)
- QGrpcChannelOperation
- Qt 6.8.0 Reference Documentation

# 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

- List of all members, including inherited members

## 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(QGrpcMetadata &&metadata)
void | setClientMetadata(const QGrpcMetadata &metadata)
void | setOptions(const QGrpcCallOptions &options)
void | setServerMetadata(QGrpcMetadata &&metadata)
void | setServerMetadata(const QGrpcMetadata &metadata)

## Signals

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

## 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)

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(QGrpcMetadata &&metadata)

Updates client metadata in the QGrpcCallOptions attribute.

The metadata then can be processed on the server side.

### 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::setOptions(const QGrpcCallOptions &options)

Updates the call options attribute.

See also options().

### void QGrpcChannelOperation::setServerMetadata(QGrpcMetadata &&metadata)

Stores the recently received server metadata.

The metadata then can be processed on the client side.

See also serverMetadata().

### void QGrpcChannelOperation::setServerMetadata(const QGrpcMetadata &metadata)

Stores the recently received server metadata.

The metadata then can be processed on the client side.