userver: Clients
Loading...
Searching...
No Matches
Clients

Detailed Description

Clients are classes that provide interfaces for requesting and retrieving data usually from remote server.

All the clients are asynchronous. In other words, a request suspends the current engine::Task and other coroutines are processed on the task processor. The suspended task resumes execution on the task processor after the data was retrieved.

It is a common practice to return references or smart pointers to clients from a component. In such cases:

  • a client lives as long as the component is alive
  • and it is safe to invoke member functions of the same client instance concurrently if not stated the opposite.
See also
Component system for information on how to configure clients

Classes

class  clients::http::Client
 HTTP client interface that returns a HTTP request builder from CreateRequest(). More...
class  baggage::BaggageManager
class  clients::dns::Resolver
 Caching DNS resolver implementation. More...
class  clients::http::ClientCore
 HTTP client that returns a HTTP request builder from CreateRequest(). More...
class  clients::http::ClientWithMiddlewares
 HTTP client that returns a HTTP request builder from CreateRequest() with applied middlewares. More...
class  dynamic_config::Client
 Client for the dynamic configs service. More...
class  dynamic_config::Source
 A client for easy dynamic config fetching in components. More...
class  engine::subprocess::ProcessStarter
 Creates a new OS subprocess and executes a command in it. More...
class  fs::FsCacheClient
 Class client for storing files in memory Usually retrieved from components::FsCache. More...
class  os_signals::Processor
 A client that allows to subscribe to OS signals SIGUSR1 and SIGUSR2. More...
class  storages::secdist::SecdistConfig
 Client to retrieve credentials from the components::Secdist. More...
class  storages::secdist::Secdist
 Client to retrieve credentials from the components::Secdist and to subscribe to their updates. More...
class  utils::statistics::Storage
class  storages::mongo::Pool
 MongoDB client pool. More...
class  storages::postgres::Cluster
 Interface for executing queries on a cluster of PostgreSQL servers. More...
class  storages::redis::Client
 Valkey or Redis client. More...
class  storages::redis::SubscribeClient
 Client that allows subscribing to Redis channel messages. More...
class  storages::clickhouse::Cluster
 Interface for executing queries on a cluster of ClickHouse servers. More...
class  ugrpc::client::ClientFactory
 Creates gRPC clients. More...
class  ugrpc::client::GenericClient
 Allows to talk to gRPC services (generic and normal) using dynamic method names. More...
class  kafka::ConsumerScope
 RAII class that used as interface for Apache Kafka Consumer interaction and proper lifetime management. More...
class  kafka::Producer
 Apache Kafka Producer Client. More...
class  urabbitmq::Client
 Interface for communicating with a RabbitMQ cluster. More...
class  storages::mysql::Cluster
 Client interface for a cluster of MySQL servers. Usually retrieved from components::MySQL. More...
class  storages::sqlite::Client
 Interface for executing queries on SQLite connection. Usually retrieved from components::SQLite. More...
class  ydb::CoordinationClient
 YDB Coordination Client. More...
class  ydb::FederatedTopicClient
 YDB Federated Topic Client. More...
class  ydb::TopicClient
 YDB Topic Client. More...
class  s3api::Client

Typedefs

using ugrpc::client::CompletionStatus = utils::expected<grpc::Status, SpecialCaseCompletionType>
 Result type for gRPC client call completion.

Enumerations

enum class  ugrpc::client::SpecialCaseCompletionType : std::uint8_t {
  ugrpc::client::SpecialCaseCompletionType::kNetworkError ,
  ugrpc::client::SpecialCaseCompletionType::kTimeoutDeadlinePropagated ,
  ugrpc::client::SpecialCaseCompletionType::kCancelled ,
  ugrpc::client::SpecialCaseCompletionType::kAbandoned
}
 Special completion types for gRPC client calls that don't result in a normal grpc::Status. More...

Typedef Documentation

◆ CompletionStatus

Result type for gRPC client call completion.

Type alias for CompletionStatus. Represents either a normal gRPC status (value) or a special completion case (error).

See also
SpecialCaseCompletionType
ugrpc::client::MiddlewareBase::PostFinish

Definition at line 75 of file completion_status.hpp.

Enumeration Type Documentation

◆ SpecialCaseCompletionType

enum class ugrpc::client::SpecialCaseCompletionType : std::uint8_t
strong

Special completion types for gRPC client calls that don't result in a normal grpc::Status.

This enum represents exceptional completion scenarios that occur during gRPC client calls when the RPC doesn't complete with a standard gRPC status. These cases are distinguished from normal status codes to provide more precise information about the nature of the failure.

See also
CompletionStatus
Enumerator
kNetworkError 

The RPC was interrupted at the network/transport level without a gRPC status.

[special_cases_declaration]

The call did not finish with a gRPC status from the server: the connection was lost, reset or otherwise interrupted. This is distinct from grpc::StatusCode::UNAVAILABLE, which is a valid gRPC status.

For a unary call this is reported only when no concrete gRPC status is available and the response could not be obtained (not received, or received but not parseable). Whenever a concrete status is available instead (for example UNAVAILABLE or CANCELLED), it is reported as that grpc::Status rather than as this special case.

Surfaces to the caller as ugrpc::client::RpcInterruptedError; for unary calls it is retryable.

kTimeoutDeadlinePropagated 

Request timed out with deadline propagation enabled.

This is distinguished from a regular grpc::StatusCode::DEADLINE_EXCEEDED to indicate that the timeout was due to propagated deadline from upstream request.

kCancelled 

RPC was explicitly cancelled by the client.

kAbandoned 

RPC was abandoned without proper completion.

The RPC object was destroyed before the call could complete normally. This happens when:

  • A streaming RPC object goes out of scope before Finish() is called
  • An async call future is destroyed without calling Get()
  • The client abandons the RPC without waiting for completion [special_cases_declaration]

Definition at line 26 of file completion_status.hpp.