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>
Until we haven't found a clear conclusion with this lets remove.
It's safe to add it afterwards but it's not safe to remove.
Task-number: QTBUG-123625
Pick-to: 6.8
Change-Id: I8ee9a3c5edd3054e11328d0e408030c6cc19c3a4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
As a final step for 6.8 let's polish the headers. That includes
formatting them and also regrouping some class members to be in
getter/setter pairs instead of having all getter or setter combined.
This makes the header, and the features it provides, much easier to
follow. Also this is the schema that we already use in e.g. grpcquick.
Pick-to: 6.8
Change-Id: I95f9f1e3c75890ae5ea2002dfe3c6a35abf7baf3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
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>
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>
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: Ibdd24155a04b0ba8a622998cbc482428965e2288
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Add a custom deleter to the std::unique_ptr so that we can
lift the SMF to be inline.
As a drive-by add the missing documentation.
Task-number: QTBUG-123625
Pick-to: 6.8
Change-Id: I11509ae925a6964f4d7e9ddd30a30c604edcb909
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
It was concluded that we will use the 'set~()' syntax in our options but
still return a reference to allow chaining.
Task-number: QTBUG-123625
Change-Id: I00838465b485d096b4b7bd3d691d24385543d662
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
It is dangerous to hand out references to temporaries. This change
optimizes and hardens the metadata() getter.
Change-Id: I7ba410879653754b2599b7e5d3b715fe382cfc5a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
std::chrono::milliseconds is already widely used in our API. Qt-ify
it for foresighted API and implementation design.
Task-number: QTBUG-120696
Change-Id: I03650045ee3c93f59b88864932dfe72442dc0925
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
rename to 'qgrpcdefs' in order to add other type definitions.
Task-number: QTBUG-120696
Change-Id: I179553a36ae861b0685a7932c6ea7b5f89d97fa6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This will follow the rule of five.
Task-number: QTBUG-123625
Pick-to: 6.7
Change-Id: I2f009f7a75b55c10a61c25f2d937c406327ff9da
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This improves tooling for return values that shouldn't be ignored.
As a drive-by mark those functions as noexcept.
Task-number: QTBUG-123625
Pick-to: 6.7
Change-Id: I838e9ff62cc6e3b75e39fd2cd972cca53abdee9e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Found in API-Review.
As a drive-by also change the includes for private headers and
implementation files.
Task-number: QTBUG-123625
Pick-to: 6.7
Change-Id: Ice4218c0425888a53d3e78c9f53aecd7b459cc69
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Small optimization bit, to avoid potential extra copy of QGrpcMetadata
aka std::unordered_multimap, which doesn't support implicit sharing.
Change-Id: I9173cde9ca743be04f00b01a608ee1cf7055ba3c
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
This feature hasn't been implemented yet and will not make it
into 6.6. Keep the API and docs sane by removing it from there.
Pick-to: 6.6 6.6.0
Change-Id: I2cb443e07a39150eafaec5714e5db69dd6ed51ce
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Remove QGrpcUserPasswordCredentials, as they are unused after introducing
QGrpcMetadata.
[ChangeLog] Removed QGrpcUserPasswordCredentials. Now user and password
credentials can be added by using QGrpcMetadata.
Task-number: QTBUG-111037
Change-Id: I8e998bae9882f238c4498f41e9f0d0a2894b49a7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Introduce alias to std::multimap names QGrpcMetadata, to represent
additional HTTP headers, that can be added to channel and call options.
Then channel implementations can use QGrpcMetadata and append all
metadata do each call (TODO).
Task-number: QTBUG-111037
Change-Id: Ie16e658407a57a5f44bc1a0ff54dcb3ca8b06fe1
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Use the new classes to store call and channel options used to
create gRPC channels and perform gRPC calls.
Add QGrpcCallOptions parameter to call() and startStream() methods.
Change constructor parameter of QGrpcHttp2Channel and QGrpcChannel
to QGrpcChannelOptions that stores previous parameters used to
construct channel. Add additional deadline option to be able to
configure call timeout.
[ChangeLog] Add QGrpcCallOptions to store and process additional
call options.
[ChangeLog] Add QGrpcChannelOptions to store and process channel
options and default call options.
Task-number: QTBUG-111037
Change-Id: Icd92e95c036fb5b4c268907ab912fcf59ef9a69a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>