46static constexpr const int kGrpcMaxMessageSize{4};
172template <
typename TClientContext>
174 auto meta = ctx.GetServerInitialMetadata();
175 auto data = meta.find(key);
176 if( data != meta.end() ) {
177 auto ref = data->second;
178 auto len = ref.length();
181 return{ref.data(), 0, len};
192template <
typename TClientContext>
194 ctx.AddMetadata(key, data);
208template <
typename TServerContext>
210 auto meta = pctx->client_metadata();
211 auto data = meta.find(key);
212 if( data != meta.end() ) {
213 auto ref = data->second;
214 auto len = ref.length();
217 return{ref.data(), 0, len};
227template <
typename TServerContext>
229 pctx->AddInitialMetadata(key, data);
Configuration parameters for gRPC client instances.
Definition tec_grpc.hpp:125
int compression_algorithm
GRPC_COMPRESS_NONE = 0, GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_ALGORITHMS_COUNT.
Definition tec_grpc.hpp:150
MilliSec connect_timeout
Timeout for client connection in milliseconds.
Definition tec_grpc.hpp:145
MilliSec close_timeout
Timeout for client closing in milliseconds.
Definition tec_grpc.hpp:146
std::string addr_uri
See kDefaultAddrUri.
Definition tec_grpc.hpp:144
static constexpr const char kDefaultAddrUri[]
Default client URI.
Definition tec_grpc.hpp:130
static constexpr MilliSec kConnectTimeout
Default timeout for client connection.
Definition tec_grpc.hpp:136
int max_message_size
See kGrpcMaxMessageSize.
Definition tec_grpc.hpp:149
static constexpr MilliSec kCloseTimeout
Default timeout for client closing.
Definition tec_grpc.hpp:142
Declare the gRPC health check service builder.
Definition tec_grpc.hpp:56
Declare the gRPC reflection service builder.
Definition tec_grpc.hpp:61
Configuration parameters for gRPC server instances.
Definition tec_grpc.hpp:71
static constexpr const char kDefaultAddrUri[]
Default server URI.
Definition tec_grpc.hpp:76
static constexpr const MilliSec kShutdownTimeout
Default timeout for gRPC shutdown.
Definition tec_grpc.hpp:88
int max_message_size
kGrpcMaxMessageSize, set to 0 to use gRPC's default (4Mb).
Definition tec_grpc.hpp:97
MilliSec shutdown_timeout
Timeout for server shutdown in milliseconds.
Definition tec_grpc.hpp:92
std::string addr_uri
See kDefaultAddrUri.
Definition tec_grpc.hpp:90
MilliSec start_timeout
Timeout for server startup in milliseconds.
Definition tec_grpc.hpp:91
int compression_algorithm
GRPC_COMPRESS_NONE = 0, GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_ALGORITHMS_COUNT.
Definition tec_grpc.hpp:98
GrpcReflectionBuilder reflection_builder
e.g. {&grpc::reflection::InitProtoReflectionServerBuilderPlugin}.
Definition tec_grpc.hpp:96
int compression_level
GRPC_COMPRESS_LEVEL_NONE = 0, GRPC_COMPRESS_LEVEL_LOW, GRPC_COMPRESS_LEVEL_MED, GRPC_COMPRESS_LEVEL_H...
Definition tec_grpc.hpp:99
static constexpr const MilliSec kStartTimeout
Default timeout for gRPC startup.
Definition tec_grpc.hpp:82
GrpcHealthCheckBuilder health_check_builder
e.g. {&grpc::EnableDefaultHealthCheckService}.
Definition tec_grpc.hpp:95
Common definitions and utilities for the tec namespace.
void add_server_medadata(TServerContext *pctx, const std::string &key, const std::string &data)
Put server's metadata on the server side.
Definition tec_grpc.hpp:228
std::string get_server_metadata(const TClientContext &ctx, const std::string &key)
Get server's metadata on the client side.
Definition tec_grpc.hpp:173
std::string get_client_metadata(const TServerContext *pctx, const std::string &key)
Get client's metadata on the server side.
Definition tec_grpc.hpp:209
void add_client_metadata(TClientContext &ctx, const std::string &key, const std::string &data)
Put client's metadata on the client side.
Definition tec_grpc.hpp:193
Provides time-related utilities and system information functions for the tec namespace.
std::chrono::seconds Seconds
Type alias for seconds duration.
Definition tec_utils.hpp:52
std::chrono::milliseconds MilliSec
Type alias for milliseconds duration.
Definition tec_utils.hpp:62