QGrpcOperation Class

The QGrpcOperation class implements common logic to handle the gRPC communication from the client side. 更多...

头: #include <QGrpcOperation>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.5
继承: QObject
继承者:

QGrpcBidirStream , QGrpcCallReply , QGrpcClientStream ,和 QGrpcServerStream

状态: 技术预览

公共函数

void cancel ()
bool isFinished () const
QGrpcMetadata metadata () const
QLatin1StringView 方法 () const
T read () const

信号

void errorOccurred (const QGrpcStatus & status ) const
void finished ()

详细描述

成员函数文档编制

void QGrpcOperation:: cancel ()

Attempts to cancel the operation in a channel and immediately emits QGrpcOperation::errorOccurred 采用 QGrpcStatus::Cancelled status code.

Any manipulation of the operation after this call has no effect.

[signal] void QGrpcOperation:: errorOccurred (const QGrpcStatus & status ) const

This signal indicates the error occurred during serialization.

This signal is emitted when error with status occurs in channel or during serialization.

另请参阅 QAbstractGrpcClient::errorOccurred .

[signal] void QGrpcOperation:: finished ()

This signal indicates the end of communication for this call.

If this signal is emitted by the stream then this stream is successfully closed either by client or server.

[noexcept] bool QGrpcOperation:: isFinished () const

Returns true when QGrpcOperation finished its workflow, meaning it was finished, canceled, or error occurred, otherwise returns false.

[noexcept] QGrpcMetadata QGrpcOperation:: metadata () const

Getter of the metadata received from the channel. For the HTTP2 channels it usually contains the HTTP headers received from the server.

[noexcept] QLatin1StringView QGrpcOperation:: 方法 () const

Getter of the method that this operation was intialized with.

template <typename T> T QGrpcOperation:: read () const

Reads message from raw byte array stored in QGrpcOperation .

Returns a deserialized message or, on failure, a default-constructed message. If deserialization is not successful the QGrpcOperation::errorOccurred 信号发射。