QGrpcCallOptions Class

The QGrpcCallOptions is an storage class used to set additional call options. 更多...

头: #include <QGrpcCallOptions>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.5
Status: Technical Preview

公共函数

QGrpcCallOptions ()
QGrpcCallOptions (const QGrpcCallOptions & other )
~QGrpcCallOptions ()
std::optional<std::chrono::milliseconds> deadline () const
std::optional<qint64> maxRetryAttempts () const
QGrpcMetadata metadata () const
QGrpcCallOptions & withDeadline (std::chrono::milliseconds deadline )
QGrpcCallOptions & withMaxRetryAttempts (qint64 maxRetryAttempts )
QGrpcCallOptions & withMetadata (const QGrpcMetadata & metadata )
QGrpcCallOptions & operator= (const QGrpcCallOptions & other )

详细描述

QGrpcCallOptions provides a set of functions to access the call options that are used by gRPC channels to communicate with the services.

成员函数文档编制

QGrpcCallOptions:: QGrpcCallOptions ()

Constructs an empty QGrpcCallOptions object.

QGrpcCallOptions:: QGrpcCallOptions (const QGrpcCallOptions & other )

Construct a copy of QGrpcCallOptions with other 对象。

[noexcept] QGrpcCallOptions:: ~QGrpcCallOptions ()

销毁 QGrpcCallOptions 对象。

std::optional < std::chrono::milliseconds > QGrpcCallOptions:: deadline () const

Returns deadline value for a call.

Deadline value controls the maximum execution time of an call or a stream. This value overrides value set by QGrpcChannelOptions::deadline () for a specific call or stream.

If value was not set returns empty std::optional.

std::optional < qint64 > QGrpcCallOptions:: maxRetryAttempts () const

Returns maximum retry attempts value for a call.

If value was not set returns empty std::optional.

QGrpcMetadata QGrpcCallOptions:: metadata () const

Returns metadata used for a call.

If value was not set returns empty QGrpcMetadata.

QGrpcCallOptions &QGrpcCallOptions:: withDeadline ( std::chrono::milliseconds deadline )

Sets deadline value with deadline and returns updated QGrpcCallOptions 对象。

QGrpcCallOptions &QGrpcCallOptions:: withMaxRetryAttempts ( qint64 maxRetryAttempts )

Sets maximum retry attempts value with maxRetryAttempts and returns updated QGrpcCallOptions 对象。

QGrpcCallOptions &QGrpcCallOptions:: withMetadata (const QGrpcMetadata & metadata )

设置 metadata for a call and returns updated QGrpcCallOptions 对象。

For HTTP2-based channels, metadata is converted into HTTP/2 headers, that added to the corresponding HTTP/2 request.

QGrpcCallOptions &QGrpcCallOptions:: operator= (const QGrpcCallOptions & other )

赋值 other 到此 QGrpcCallOptions and returns a reference to this QGrpcCallOptions .