userver: ugrpc::client Namespace Reference
Loading...
Searching...
No Matches
ugrpc::client Namespace Reference

Detailed Description

Client-side utilities.

Classes

class  AbortedError
 
class  AlreadyExistsError
 
class  BaseError
 Base exception for all the client errors. More...
 
class  BidirectionalStream
 Controls a request stream -> response stream RPC. More...
 
class  CallAnyBase
 Base class for any RPC. More...
 
class  CancelledError
 Concrete errors for all the error codes. More...
 
class  ClientFactory
 Creates gRPC clients. More...
 
class  ClientFactoryComponent
 Provides a ClientFactory in the component system. More...
 
struct  ClientFactorySettings
 Settings relating to the ClientFactory. More...
 
struct  ClientSettings
 Settings relating to creation of a code-generated client. More...
 
class  CommonComponent
 Contains common machinery that's required for all ugrpc clients. More...
 
class  DataLossError
 
class  DeadlineExceededError
 
class  ErrorWithStatus
 Error with grpc::Status details. More...
 
class  FailedPreconditionError
 
class  GenericClient
 Allows to talk to gRPC services (generic and normal) using dynamic method names. More...
 
struct  GenericOptions
 
class  InputStream
 Controls a single request -> response stream RPC. More...
 
class  InternalError
 
class  InvalidArgumentError
 
class  MiddlewareBase
 Base class for client gRPC middleware. More...
 
class  MiddlewareCallContext
 Context for middleware-specific data during gRPC call. More...
 
class  MiddlewareComponentBase
 Base class for client middleware component. More...
 
class  MiddlewareFactoryBase
 Factory that creates specific client middlewares for clients. More...
 
class  NotFoundError
 
class  OutOfRangeError
 
class  OutputStream
 Controls a request stream -> single response RPC. More...
 
class  PermissionDeniedError
 
struct  Qos
 Per-RPC quality-of-service config. Taken from ugrpc::client::ClientQos. Can also be passed to ugrpc client methods manually. More...
 
class  ResourceExhaustedError
 
class  ResponseFuture
 
class  RpcCancelledError
 RPC failed due to task cancellation. More...
 
class  RpcError
 Error during an RPC. More...
 
class  RpcInterruptedError
 RPC failed without a status. This means that either the call got cancelled using TryCancel, the deadline has expired, or the channel is broken. More...
 
class  SimpleClientComponent
 Template class for a simple gRPC client. More...
 
class  StreamReadFuture
 StreamReadFuture for waiting a single read response from stream. More...
 
class  UnaryCall
 Controls a single request -> single response RPC. More...
 
class  UnaryFuture
 UnaryFuture for waiting a single response RPC. More...
 
class  UnauthenticatedError
 
class  UnavailableError
 
class  UnimplementedError
 
class  UnknownError
 

Typedefs

using DedicatedMethodsConfig = std::unordered_map<std::string, std::size_t>
 
using ClientQos = utils::DefaultDict<Qos>
 Maps full RPC names (full.service.Name/MethodName) to their QOS configs. It is also possible to set __default__ QOS that will be used in place of missing entries.
 
using MiddlewareFactories = std::vector<std::shared_ptr<const MiddlewareFactoryBase>>
 
using Middlewares = std::vector<std::shared_ptr<const MiddlewareBase>>
 A chain of middlewares.
 

Enumerations

enum class  CallKind {
  kUnaryCall ,
  kInputStream ,
  kOutputStream ,
  kBidirectionalStream
}
 RPCs kinds. More...
 

Functions

template<typename T >
Qos Convert (const T &value, chaotic::convert::To< Qos >)
 
template<typename T >
Convert (const Qos &value, chaotic::convert::To< T >)
 
std::shared_ptr< grpc::Channel > MakeChannel (engine::TaskProcessor &blocking_task_processor, std::shared_ptr< grpc::ChannelCredentials > channel_credentials, const std::string &endpoint)
 Create a new gRPC channel (connection pool) for the endpoint.
 
template<typename Client >
bool TryWaitForConnected (Client &client, engine::Deadline deadline, engine::TaskProcessor &blocking_task_processor)
 Wait until the channel state of client is READY. If the current state is already READY, returns true immediately. In case of multiple underlying channels, waits for all of them.
 
bool operator== (const Qos &lhs, const Qos &rhs) noexcept
 
Qos Parse (const formats::json::Value &value, formats::parse::To< Qos >)
 
formats::json::Value Serialize (const Qos &qos, formats::serialize::To< formats::json::Value >)
 

Typedef Documentation

◆ ClientQos

Maps full RPC names (full.service.Name/MethodName) to their QOS configs. It is also possible to set __default__ QOS that will be used in place of missing entries.

Definition at line 18 of file client_qos.hpp.

◆ DedicatedMethodsConfig

using ugrpc::client::DedicatedMethodsConfig = std::unordered_map<std::string, std::size_t>

Definition at line 20 of file client_factory_settings.hpp.

◆ MiddlewareFactories

using ugrpc::client::MiddlewareFactories = std::vector<std::shared_ptr<const MiddlewareFactoryBase>>

Definition at line 101 of file base.hpp.

◆ Middlewares

using ugrpc::client::Middlewares = std::vector<std::shared_ptr<const MiddlewareBase>>

A chain of middlewares.

Definition at line 17 of file fwd.hpp.

Enumeration Type Documentation

◆ CallKind

enum class ugrpc::client::CallKind
strong

RPCs kinds.

Definition at line 8 of file call_kind.hpp.

Function Documentation

◆ Convert() [1/2]

template<typename T >
T ugrpc::client::Convert ( const Qos & value,
chaotic::convert::To< T >  )

Definition at line 18 of file qos.hpp.

◆ Convert() [2/2]

template<typename T >
Qos ugrpc::client::Convert ( const T & value,
chaotic::convert::To< Qos >  )

Definition at line 11 of file qos.hpp.

◆ MakeChannel()

std::shared_ptr< grpc::Channel > ugrpc::client::MakeChannel ( engine::TaskProcessor & blocking_task_processor,
std::shared_ptr< grpc::ChannelCredentials > channel_credentials,
const std::string & endpoint )

Create a new gRPC channel (connection pool) for the endpoint.

Channel creation is expensive, reuse channels if possible.

Each channel is fully thread-safe: it can be used across multiple threads, possibly from multiple clients and using multiple CompletionQueue instances at the same time.

Parameters
blocking_task_processortask processor for blocking channel creation
channel_credentialschannel credentials
endpointstring host:port
Returns
shared pointer to the gRPC channel

◆ TryWaitForConnected()

template<typename Client >
bool ugrpc::client::TryWaitForConnected ( Client & client,
engine::Deadline deadline,
engine::TaskProcessor & blocking_task_processor )

Wait until the channel state of client is READY. If the current state is already READY, returns true immediately. In case of multiple underlying channels, waits for all of them.

Returns
true if the state changed before deadline expired
Note
The wait operation does not support task cancellations

Definition at line 62 of file channels.hpp.