Commit Graph

8 Commits

Author SHA1 Message Date
Dennis Oberst 60446214bb QGrpc{Call,Channel}Options: provide equality operators
It makes sense to provide the equality operators to these classes.
However, omit the otherwise common 'qHash' functionality as it makes no
sense to hash a options class.

[ChangeLog][QGrpcCallOptions/QGrpcChannelOptions] Made the options
classes equality comparable.

Task-number: QTBUG-128338
Change-Id: Idb7ff6946dfef373eba32839ac4b3faf2ff4e5c2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-10-01 12:07:03 +02:00
Dennis Oberst 25782e8866 QGrpc{Call,Channel}Options: add 'filterServerMetadata'
This option enables to control the filtering of the received server
metadata. Both options provide it as optional<bool>, so that
QAbstractGrpcChannel implementations should choose a reasonable default.

This has not been provided to the QQml*Options, as there is currently no
available API to access the server metadata.

[ChangeLog][QGrpc{Call,Channel}Options] Added the filterServerMetadata
property.

Task-number: QTBUG-138363
Change-Id: I325a3b4f6e68d63f0828a6deb1a7be883247614b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-08-05 19:23:00 +02:00
Dennis Oberst 778371b8ea Deprecate QHash<QBA,QBA> metadata in favor of QMultiHash
Even though gRPC provides some leeway, as "Access to metadata is
language dependent", we have yet to see an implementation which doesn't
support multiple values per key.

Common implementations like grpc-c++, grpc-go or grpc-java provide this
and we should do it aswell.

Ref: https://grpc.io/docs/what-is-grpc/core-concepts/#metadata
Ref: https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md#constructing-metadata

Use a base class to implement common functionality for the options
classes. Also use a new common class in the tests.

The QMultiHash overload is selected when the 'QtGrpc::MultiValue'
argument is used in 'metadata' calls. We update the documentation
accordingly.

Deprecation is scheduled for Qt 6.13

Users with a custom Qt build - those who care - should be rewarded with
minimal traces of this "accident" and should not suffer from potential
performance/storage overhead. Therefore we deprecate QtGrpc::MultiValue
for those builds, effectively providing Qt 7 behavior.

[ChangeLog][Deprecation Notice]
Deprecate the metadata()/setMetadata() methods on QGrpcCallOptions and
QGrpcChannelOptions that use QHash in favor of the new overloads that
use QMultiHash. This is more in line with the gRPC specification.

Fixes: QTBUG-136471
Change-Id: I58d14d2c304c06de269c99ba5383beee86d12f77
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-05-16 14:42:11 +02:00
Jaime Resano c0599b3840 Fix channel options test when no SSL is configured
The channel options test should not check the SSL configuration when
SSL has not been configured

Fixes: QTBUG-131134
Pick-to: 6.8
Change-Id: I6356d0e7b9330a6b5d6830da93d4bb0958f6dcf7
Reviewed-by: Jaime Resano <Jaime.RESANO-AISA@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-11-13 11:33:11 +01:00
Dennis Oberst 19711e1d33 QGrpc{Channel, Call}Options: rename deadline to deadlineTimeout
We're setting the timeout value. The actual deadline is then calculated
right before the RPC starts. Rename the getters and setters to reflect
that.

Documentation update will be in a follow-up.

Task-number: QTBUG-125406
Pick-to: 6.8
Change-Id: If75c7ca9e1963b6e0b1816897a9f2fbe77b42d08
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-08-21 10:30:02 +02:00
Dennis Oberst f30945b7f5 QGrpcMetadata: use QHash instead of std::unordered_multimap <QBA, QBA>
There is likely already an instantiation available for it. Prefer the
usage of QHash to stay within the (Qt) lib boundary.

Remove qgrpcdefs.h as it's now obsolete. Update all occurrences of
QGrpcMetadata.

Task-number: QTBUG-123625
Pick-to: 6.8
Change-Id: Ida7bcd851c2d4b247c1b7a8dccddc3d518e0b5ae
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-07-29 09:21:18 +02:00
Dennis Oberst cc39238bbb Revert QGrpcDuration and use std::chrono::milliseconds directly again
This aligns with Qt's chrono first.

This commit reverts: 7a7e5a1c0c4f8070cf153f2b2979bd2f8d5f7ea8.

Task-number: QTBUG-123625
Pick-to: 6.8
Change-Id: If69b317e7cb52a90dfb2b5fd5859282acc51155c
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-07-29 09:21:13 +02:00
Dennis Oberst 72a4cc0af6 QGrpcChannelOptions: transform into implicitly shared value class
As this class is copyable and really looks like a implicitly shared
value class transform it into such.

Also provide the missing testcase to this class.

Task-number: QTBUG-123625
Pick-to: 6.8
Change-Id: I00a18a2a65e47e8b255d4f1427f7f506c648fe6c
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-07-29 09:21:00 +02:00