QGrpcChannel Class

The QGrpcChannel class is a gRPC-cpp native api implementation of QAbstractGrpcChannel interface. More...

Header: #include <QGrpcChannel>
Inherits: QAbstractGrpcChannel

Public Functions

QGrpcChannel(const QGrpcChannelOptions &options, NativeGrpcChannelCredentials credentialsType)
virtual ~QGrpcChannel() override
int call(QLatin1StringView method, QLatin1StringView service, QByteArrayView args, const QGrpcCallOptions &options = QGrpcCallOptions()) override
int serializer() const override
int startStream(QLatin1StringView method, QLatin1StringView service, QByteArrayView arg, const QGrpcCallOptions &options = QGrpcCallOptions()) override

Reimplemented Public Functions

virtual QGrpcStatus call(QLatin1StringView method, QLatin1StringView service, QByteArrayView args, QByteArray &ret, const QGrpcCallOptions &options = QGrpcCallOptions()) override

Detailed Description

\inmoduleQtGrpc

QGrpcChannel accepts the same grpc::ChannelCredentials type that is required by native-api grpc::CreateChannel.

See also gRPC ChannelCredentials.

Member Function Documentation

[explicit] QGrpcChannel::QGrpcChannel(const QGrpcChannelOptions &options, NativeGrpcChannelCredentials credentialsType)

Constructs a gRPC channel, with options and credentialsType.

[override virtual noexcept] QGrpcChannel::~QGrpcChannel()

Destroys the QGrpcChannel object.

[override virtual] QGrpcStatus QGrpcChannel::call(QLatin1StringView method, QLatin1StringView service, QByteArrayView args, QByteArray &ret, const QGrpcCallOptions &options = QGrpcCallOptions())

Reimplements: QAbstractGrpcChannel::call(QLatin1StringView method, QLatin1StringView service, QByteArrayView args, QByteArray &ret, const QGrpcCallOptions &options).

Synchronously calls the RPC method and writes the result to the output parameter ret.

The RPC method name is constructed by concatenating the method and service parameters and called with the args argument. Uses options argument to set additional parameter for the call.

int QGrpcChannel::call(QLatin1StringView method, QLatin1StringView service, QByteArrayView args, const QGrpcCallOptions &options = QGrpcCallOptions())

Asynchronously calls the RPC method.

The RPC method name is constructed by concatenating the method and service parameters and called with the args argument. Uses options argument to set additional parameter for the call. The method can emit QGrpcCallReply::finished() and QGrpcCallReply::errorOccurred() signals on a QGrpcCallReply returned object.

int QGrpcChannel::serializer() const

Returns the newly created QProtobufSerializer shared pointer.

int QGrpcChannel::startStream(QLatin1StringView method, QLatin1StringView service, QByteArrayView arg, const QGrpcCallOptions &options = QGrpcCallOptions())

Creates and starts a stream to the RPC method.

The RPC method name is constructed by concatenating the method and service parameters and called with the arg argument. Returns a shared pointer to the QGrpcStream. Uses options argument to set additional parameter for the stream.

Calls QGrpcStream::updateData() when the stream receives data from the server. The method may emit QGrpcStream::errorOccurred() when the stream has terminated with an error.