QGrpcCallOptions Class

The QGrpcCallOptions class offers various options for fine-tuning individual RPCs. 更多...

頭: #include <QGrpcCallOptions>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.6
在 QML: GrpcCallOptions

公共函數

QGrpcCallOptions ()
QGrpcCallOptions (const QGrpcCallOptions & other )
QGrpcCallOptions (QGrpcCallOptions && other )
~QGrpcCallOptions ()
std::optional<std::chrono::milliseconds> deadlineTimeout () const
QHash<QByteArray, QByteArray> metadata () &&
const QHash<QByteArray, QByteArray> & metadata () const &
QGrpcCallOptions & setDeadlineTimeout (std::chrono::milliseconds timeout )
QGrpcCallOptions & setMetadata (QHash<QByteArray, QByteArray> && metadata )
QGrpcCallOptions & setMetadata (const QHash<QByteArray, QByteArray> & metadata )
(從 6.8 起) void swap (QGrpcCallOptions & other )
(從 6.8 起) QVariant operator QVariant () const
QGrpcCallOptions & operator= (QGrpcCallOptions && other )
QGrpcCallOptions & operator= (const QGrpcCallOptions & other )
(從 6.8 起) QDebug operator<< (QDebug debug , const QGrpcCallOptions & callOpts )

詳細描述

QGrpcCallOptions lets you customize individual remote procedure calls (RPCs). The generated client interface provides access points to pass the QGrpcCallOptions. These options supersede the ones set via QGrpcChannelOptions .

To configure the default options shared by RPCs, use QGrpcChannelOptions .

成員函數文檔編製

QGrpcCallOptions &QGrpcCallOptions:: setMetadata ( QHash < QByteArray , QByteArray > && metadata )

QGrpcCallOptions &QGrpcCallOptions:: setMetadata (const QHash < QByteArray , QByteArray > & metadata )

Sets the client metadata for a specific RPC and returns a reference to the updated object.

注意: QGrpcHttp2Channel transports metadata as HTTP/2 headers. are case-insensitive ASCII strings. You must avoid using the internal prefixes: : (pseudo-header), grpc- ,或 qtgrpc- . may be either ASCII strings or binary data. For more information, see RFC 7540, Section 8.1.2 .

注意: Setting this field overrides the value set by QGrpcChannelOptions::setMetadata () for a specific RPC.

QHash < QByteArray , QByteArray > QGrpcCallOptions:: metadata () &&

[noexcept] const QHash < QByteArray , QByteArray > &QGrpcCallOptions:: metadata () const &

Returns the client metadata for a specific RPC. If this field is unset, returns empty metadata.

注意: QGrpcHttp2Channel transports metadata as HTTP/2 headers. are case-insensitive ASCII strings. You must avoid using the internal prefixes: : (pseudo-header), grpc- ,或 qtgrpc- . may be either ASCII strings or binary data. For more information, see RFC 7540, Section 8.1.2 .

QGrpcCallOptions:: QGrpcCallOptions ()

Default-constructs an empty QGrpcCallOptions.

QGrpcCallOptions:: QGrpcCallOptions (const QGrpcCallOptions & other )

Copy-constructs a QGrpcCallOptions from other .

[noexcept] QGrpcCallOptions:: QGrpcCallOptions ( QGrpcCallOptions && other )

Move-constructs a new QGrpcCallOptions from other .

注意: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.

[noexcept] QGrpcCallOptions:: ~QGrpcCallOptions ()

銷毀 QGrpcCallOptions .

[noexcept] std::optional < std::chrono::milliseconds > QGrpcCallOptions:: deadlineTimeout () const

Returns the timeout duration that is used to calculate the deadline for a specific RPC.

If this field is unset, returns an empty std::optional .

另請參閱 setDeadlineTimeout ().

QGrpcCallOptions &QGrpcCallOptions:: setDeadlineTimeout ( std::chrono::milliseconds timeout )

設置 timeout for a specific RPC and returns a reference to the updated object.

A deadline sets the limit for how long a client is willing to wait for a response from a server. The actual deadline is computed by adding the timeout to the start time of the RPC.

The deadline applies to the entire lifetime of an RPC, which includes receiving the final QGrpcStatus for a previously started call and can thus be unwanted for (long-lived) streams.

注意: Setting this field overrides the value set by QGrpcChannelOptions::setDeadline() for a specific RPC.

另請參閱 deadlineTimeout ().

[noexcept, since 6.8] void QGrpcCallOptions:: swap ( QGrpcCallOptions & other )

交換 other 與此對象。此操作很快且從不失敗。

該函數在 Qt 6.8 引入。

[since 6.8] QVariant QGrpcCallOptions:: operator QVariant () const

構造新的 QVariant from this object.

該函數在 Qt 6.8 引入。

[noexcept] QGrpcCallOptions &QGrpcCallOptions:: operator= ( QGrpcCallOptions && other )

移動賦值 other 到此 QGrpcCallOptions and returns a reference to the updated object.

注意: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.

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

賦值 other 到此 QGrpcCallOptions and returns a reference to the updated object.

相關非成員

[since 6.8] QDebug operator<< ( QDebug debug , const QGrpcCallOptions & callOpts )

寫入 callOpts to the specified stream debug .

該函數在 Qt 6.8 引入。