blob: 2c5823f786fc05ccb3a92bc5ab371ab13f633376 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
// Copyright 2023 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Automatically generated by tools/codegen/core/gen_config_vars.py
//
#ifndef GRPC_SRC_CORE_LIB_CONFIG_CONFIG_VARS_H
#define GRPC_SRC_CORE_LIB_CONFIG_CONFIG_VARS_H
#include <grpc/support/port_platform.h>
#include <stdint.h>
#include <atomic>
#include <util/generic/string.h>
#include <util/string/cast.h>
#include "y_absl/strings/string_view.h"
#include "y_absl/types/optional.h"
namespace grpc_core {
class ConfigVars {
public:
struct Overrides {
y_absl::optional<int32_t> client_channel_backup_poll_interval_ms;
y_absl::optional<bool> enable_fork_support;
y_absl::optional<bool> abort_on_leaks;
y_absl::optional<bool> not_use_system_ssl_roots;
y_absl::optional<TString> experiments;
y_absl::optional<TString> dns_resolver;
y_absl::optional<TString> trace;
y_absl::optional<TString> verbosity;
y_absl::optional<TString> stacktrace_minloglevel;
y_absl::optional<TString> poll_strategy;
y_absl::optional<TString> system_ssl_roots_dir;
y_absl::optional<TString> default_ssl_roots_file_path;
y_absl::optional<TString> ssl_cipher_suites;
};
ConfigVars(const ConfigVars&) = delete;
ConfigVars& operator=(const ConfigVars&) = delete;
// Get the core configuration; if it does not exist, create it.
static const ConfigVars& Get() {
auto* p = config_vars_.load(std::memory_order_acquire);
if (p != nullptr) return *p;
return Load();
}
static void SetOverrides(const Overrides& overrides);
// Drop the config vars. Users must ensure no other threads are
// accessing the configuration.
static void Reset();
TString ToString() const;
// A comma separated list of currently active experiments. Experiments may be
// prefixed with a '-' to disable them.
y_absl::string_view Experiments() const { return experiments_; }
// Declares the interval in ms between two backup polls on client channels.
// These polls are run in the timer thread so that gRPC can process connection
// failures while there is no active polling thread. They help reconnect
// disconnected client channels (mostly due to idleness), so that the next RPC
// on this channel won't fail. Set to 0 to turn off the backup polls.
int32_t ClientChannelBackupPollIntervalMs() const {
return client_channel_backup_poll_interval_ms_;
}
// Declares which DNS resolver to use. The default is ares if gRPC is built
// with c-ares support. Otherwise, the value of this environment variable is
// ignored.
y_absl::string_view DnsResolver() const { return dns_resolver_; }
// A comma separated list of tracers that provide additional insight into how
// gRPC C core is processing requests via debug logs.
y_absl::string_view Trace() const { return trace_; }
// Default gRPC logging verbosity
y_absl::string_view Verbosity() const { return verbosity_; }
// Messages logged at the same or higher level than this will print stacktrace
y_absl::string_view StacktraceMinloglevel() const {
return stacktrace_minloglevel_;
}
// Enable fork support
bool EnableForkSupport() const { return enable_fork_support_; }
// Declares which polling engines to try when starting gRPC. This is a
// comma-separated list of engines, which are tried in priority order first ->
// last.
y_absl::string_view PollStrategy() const { return poll_strategy_; }
// A debugging aid to cause a call to abort() when gRPC objects are leaked
// past grpc_shutdown()
bool AbortOnLeaks() const { return abort_on_leaks_; }
// Custom directory to SSL Roots
TString SystemSslRootsDir() const;
// Path to the default SSL roots file.
TString DefaultSslRootsFilePath() const;
// Disable loading system root certificates.
bool NotUseSystemSslRoots() const { return not_use_system_ssl_roots_; }
// A colon separated list of cipher suites to use with OpenSSL
y_absl::string_view SslCipherSuites() const { return ssl_cipher_suites_; }
private:
explicit ConfigVars(const Overrides& overrides);
static const ConfigVars& Load();
static std::atomic<ConfigVars*> config_vars_;
int32_t client_channel_backup_poll_interval_ms_;
bool enable_fork_support_;
bool abort_on_leaks_;
bool not_use_system_ssl_roots_;
TString experiments_;
TString dns_resolver_;
TString trace_;
TString verbosity_;
TString stacktrace_minloglevel_;
TString poll_strategy_;
TString ssl_cipher_suites_;
y_absl::optional<TString> override_system_ssl_roots_dir_;
y_absl::optional<TString> override_default_ssl_roots_file_path_;
};
} // namespace grpc_core
#endif // GRPC_SRC_CORE_LIB_CONFIG_CONFIG_VARS_H
|