The QGrpcChannelOptions class offers various options for fine-tuning a gRPC channel. 更多...
| 头: |
#include <QGrpcChannelOptions>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
|
| Since: | Qt 6.6 |
| 在 QML: | GrpcChannelOptions |
| QGrpcChannelOptions () | |
| QGrpcChannelOptions (const QGrpcChannelOptions & other ) | |
| QGrpcChannelOptions (QGrpcChannelOptions && other ) | |
| ~QGrpcChannelOptions () | |
| std::optional<std::chrono::milliseconds> | deadlineTimeout () const |
| QHash<QByteArray, QByteArray> | metadata () && |
| const QHash<QByteArray, QByteArray> & | metadata () const & |
(从 6.8 起)
QGrpcSerializationFormat
|
serializationFormat () const |
| QGrpcChannelOptions & | setDeadlineTimeout (std::chrono::milliseconds timeout ) |
| QGrpcChannelOptions & | setMetadata (QHash<QByteArray, QByteArray> && metadata ) |
| QGrpcChannelOptions & | setMetadata (const QHash<QByteArray, QByteArray> & metadata ) |
(从 6.8 起)
QGrpcChannelOptions &
|
setSerializationFormat (const QGrpcSerializationFormat & format ) |
| QGrpcChannelOptions & | setSslConfiguration (const QSslConfiguration & sslConfiguration ) |
| std::optional<QSslConfiguration> | sslConfiguration () const |
(从 6.8 起)
void
|
swap (QGrpcChannelOptions & other ) |
(从 6.8 起)
QVariant
|
operator QVariant () const |
| QGrpcChannelOptions & | operator= (QGrpcChannelOptions && other ) |
| QGrpcChannelOptions & | operator= (const QGrpcChannelOptions & other ) |
(从 6.8 起)
QDebug
|
operator<< (QDebug debug , const QGrpcChannelOptions & chOpts ) |
QGrpcChannelOptions lets you customize a gRPC ™ channel. Some options apply to all remote procedure calls (RPCs) that operate on the associated channel, which is used to communicate with services.
Override options for specific RPCs with QGrcCallOptions.
注意: It is up to the channel's implementation to determine the specifics of these options.
Sets the client metadata for the channel 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
.
注意: The metadata set via the channel options applies to all RPCs that operate on the channel, except those overridden by QGrpcCallOptions::setMetadata ().
[noexcept]
const
QHash
<
QByteArray
,
QByteArray
> &QGrpcChannelOptions::
metadata
() const &
Returns the client metadata for the channel.
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
.
Default-constructs an empty QGrpcChannelOptions.
Copy-constructs a QGrpcChannelOptions from other .
[noexcept]
QGrpcChannelOptions::
QGrpcChannelOptions
(
QGrpcChannelOptions
&&
other
)
Move-constructs a new QGrpcChannelOptions 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]
QGrpcChannelOptions::
~QGrpcChannelOptions
()
销毁 QGrpcChannelOptions .
[noexcept]
std::optional
<
std::chrono::milliseconds
> QGrpcChannelOptions::
deadlineTimeout
() const
Returns the timeout duration that is used to calculate the deadline for the channel.
If this field is unset, returns an empty
std::optional
.
另请参阅 setDeadlineTimeout ().
[since 6.8]
QGrpcSerializationFormat
QGrpcChannelOptions::
serializationFormat
() const
Returns the serialization format used by the channel.
If this field is unset, returns a 默认 constructed serialization format.
该函数在 Qt 6.8 引入。
另请参阅 setSerializationFormat ().
设置 timeout for the channel 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.
注意: The deadline set via the channel options applies to all RPCs that operate on the channel, except those overridden by QGrpcCallOptions::setDeadline().
另请参阅 deadlineTimeout ().
[since 6.8]
QGrpcChannelOptions
&QGrpcChannelOptions::
setSerializationFormat
(const
QGrpcSerializationFormat
&
format
)
Sets the serialization format for the channel and returns a reference to the updated object.
该函数在 Qt 6.8 引入。
另请参阅 serializationFormat ().
设置 sslConfiguration for the channel and returns a reference to the updated object.
另请参阅 sslConfiguration ().
Returns the SSL configuration for the channel.
If this field is unset, returns an empty
std::optional
.
另请参阅 setSslConfiguration ().
[noexcept, since 6.8]
void
QGrpcChannelOptions::
swap
(
QGrpcChannelOptions
&
other
)
交换 other 与此对象。此操作非常快且从不失败。
该函数在 Qt 6.8 引入。
[since 6.8]
QVariant
QGrpcChannelOptions::
operator QVariant
() const
构造新的 QVariant from this object.
该函数在 Qt 6.8 引入。
[noexcept]
QGrpcChannelOptions
&QGrpcChannelOptions::
operator=
(
QGrpcChannelOptions
&&
other
)
移动赋值 other 到此 QGrpcChannelOptions 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.
赋值 other 到此 QGrpcChannelOptions and returns a reference to the updated object.
[since 6.8]
QDebug
operator<<
(
QDebug
debug
, const
QGrpcChannelOptions
&
chOpts
)
写入 chOpts to the specified stream debug .
该函数在 Qt 6.8 引入。