aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/config/session_config.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/messagebus/config/session_config.cpp
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus/config/session_config.cpp')
-rw-r--r--library/cpp/messagebus/config/session_config.cpp108
1 files changed, 54 insertions, 54 deletions
diff --git a/library/cpp/messagebus/config/session_config.cpp b/library/cpp/messagebus/config/session_config.cpp
index fbbbb106c9..31c7dd29f2 100644
--- a/library/cpp/messagebus/config/session_config.cpp
+++ b/library/cpp/messagebus/config/session_config.cpp
@@ -13,8 +13,8 @@ TBusSessionConfig::TSecret::TSecret()
TBusSessionConfig::TBusSessionConfig()
: BUS_SESSION_CONFIG_MAP(STRUCT_FIELD_INIT, COMMA)
-{
-}
+{
+}
TString TBusSessionConfig::PrintToString() const {
TStringStream ss;
@@ -40,10 +40,10 @@ static int ParseToSForMessageBus(const char* option) {
return tos;
}
-template <class T>
-static T ParseWithKmgSuffixT(const char* option) {
+template <class T>
+static T ParseWithKmgSuffixT(const char* option) {
TStringBuf str(option);
- T multiplier = 1;
+ T multiplier = 1;
if (str.EndsWith('k')) {
multiplier = 1024;
str = str.Head(str.size() - 1);
@@ -54,104 +54,104 @@ static T ParseWithKmgSuffixT(const char* option) {
multiplier = 1024 * 1024 * 1024;
str = str.Head(str.size() - 1);
}
- return FromString<T>(str) * multiplier;
-}
-
-static ui64 ParseWithKmgSuffix(const char* option) {
- return ParseWithKmgSuffixT<ui64>(option);
-}
-
-static i64 ParseWithKmgSuffixS(const char* option) {
- return ParseWithKmgSuffixT<i64>(option);
+ return FromString<T>(str) * multiplier;
}
+static ui64 ParseWithKmgSuffix(const char* option) {
+ return ParseWithKmgSuffixT<ui64>(option);
+}
+
+static i64 ParseWithKmgSuffixS(const char* option) {
+ return ParseWithKmgSuffixT<i64>(option);
+}
+
void TBusSessionConfig::ConfigureLastGetopt(NLastGetopt::TOpts& opts,
const TString& prefix) {
opts.AddLongOption(prefix + "total-timeout")
- .RequiredArgument("MILLISECONDS")
- .DefaultValue(ToString(TotalTimeout))
+ .RequiredArgument("MILLISECONDS")
+ .DefaultValue(ToString(TotalTimeout))
.StoreMappedResultT<const char*>(&TotalTimeout,
&ParseDurationForMessageBus);
opts.AddLongOption(prefix + "connect-timeout")
- .RequiredArgument("MILLISECONDS")
- .DefaultValue(ToString(ConnectTimeout))
+ .RequiredArgument("MILLISECONDS")
+ .DefaultValue(ToString(ConnectTimeout))
.StoreMappedResultT<const char*>(&ConnectTimeout,
&ParseDurationForMessageBus);
opts.AddLongOption(prefix + "send-timeout")
- .RequiredArgument("MILLISECONDS")
- .DefaultValue(ToString(SendTimeout))
+ .RequiredArgument("MILLISECONDS")
+ .DefaultValue(ToString(SendTimeout))
.StoreMappedResultT<const char*>(&SendTimeout,
&ParseDurationForMessageBus);
opts.AddLongOption(prefix + "send-threshold")
- .RequiredArgument("BYTES")
- .DefaultValue(ToString(SendThreshold))
+ .RequiredArgument("BYTES")
+ .DefaultValue(ToString(SendThreshold))
.StoreMappedResultT<const char*>(&SendThreshold, &ParseWithKmgSuffix);
opts.AddLongOption(prefix + "max-in-flight")
- .RequiredArgument("COUNT")
- .DefaultValue(ToString(MaxInFlight))
+ .RequiredArgument("COUNT")
+ .DefaultValue(ToString(MaxInFlight))
.StoreMappedResultT<const char*>(&MaxInFlight, &ParseWithKmgSuffix);
opts.AddLongOption(prefix + "max-in-flight-by-size")
- .RequiredArgument("BYTES")
- .DefaultValue(
- ToString(MaxInFlightBySize))
- .StoreMappedResultT<const char*>(&MaxInFlightBySize, &ParseWithKmgSuffixS);
+ .RequiredArgument("BYTES")
+ .DefaultValue(
+ ToString(MaxInFlightBySize))
+ .StoreMappedResultT<const char*>(&MaxInFlightBySize, &ParseWithKmgSuffixS);
opts.AddLongOption(prefix + "per-con-max-in-flight")
- .RequiredArgument("COUNT")
- .DefaultValue(ToString(PerConnectionMaxInFlight))
+ .RequiredArgument("COUNT")
+ .DefaultValue(ToString(PerConnectionMaxInFlight))
.StoreMappedResultT<const char*>(&PerConnectionMaxInFlight,
&ParseWithKmgSuffix);
opts.AddLongOption(prefix + "per-con-max-in-flight-by-size")
- .RequiredArgument("BYTES")
- .DefaultValue(
- ToString(PerConnectionMaxInFlightBySize))
+ .RequiredArgument("BYTES")
+ .DefaultValue(
+ ToString(PerConnectionMaxInFlightBySize))
.StoreMappedResultT<const char*>(&PerConnectionMaxInFlightBySize,
&ParseWithKmgSuffix);
opts.AddLongOption(prefix + "default-buffer-size")
- .RequiredArgument("BYTES")
- .DefaultValue(ToString(DefaultBufferSize))
+ .RequiredArgument("BYTES")
+ .DefaultValue(ToString(DefaultBufferSize))
.StoreMappedResultT<const char*>(&DefaultBufferSize,
&ParseWithKmgSuffix);
opts.AddLongOption(prefix + "max-buffer-size")
- .RequiredArgument("BYTES")
- .DefaultValue(ToString(MaxBufferSize))
+ .RequiredArgument("BYTES")
+ .DefaultValue(ToString(MaxBufferSize))
.StoreMappedResultT<const char*>(&MaxBufferSize, &ParseWithKmgSuffix);
opts.AddLongOption(prefix + "max-message-size")
- .RequiredArgument("BYTES")
- .DefaultValue(ToString(MaxMessageSize))
+ .RequiredArgument("BYTES")
+ .DefaultValue(ToString(MaxMessageSize))
.StoreMappedResultT<const char*>(&MaxMessageSize, &ParseWithKmgSuffix);
opts.AddLongOption(prefix + "socket-recv-buffer-size")
- .RequiredArgument("BYTES")
- .DefaultValue(ToString(SocketRecvBufferSize))
+ .RequiredArgument("BYTES")
+ .DefaultValue(ToString(SocketRecvBufferSize))
.StoreMappedResultT<const char*>(&SocketRecvBufferSize,
&ParseWithKmgSuffix);
opts.AddLongOption(prefix + "socket-send-buffer-size")
- .RequiredArgument("BYTES")
- .DefaultValue(ToString(SocketSendBufferSize))
+ .RequiredArgument("BYTES")
+ .DefaultValue(ToString(SocketSendBufferSize))
.StoreMappedResultT<const char*>(&SocketSendBufferSize,
&ParseWithKmgSuffix);
opts.AddLongOption(prefix + "socket-tos")
.RequiredArgument("[0x00, 0xFF]")
- .StoreMappedResultT<const char*>(&SocketToS, &ParseToSForMessageBus);
- ;
+ .StoreMappedResultT<const char*>(&SocketToS, &ParseToSForMessageBus);
+ ;
opts.AddLongOption(prefix + "tcp-cork")
- .RequiredArgument("BOOL")
- .DefaultValue(ToString(TcpCork))
+ .RequiredArgument("BOOL")
+ .DefaultValue(ToString(TcpCork))
.StoreResult(&TcpCork);
opts.AddLongOption(prefix + "cork")
- .RequiredArgument("SECONDS")
- .DefaultValue(
- ToString(Cork.Seconds()))
+ .RequiredArgument("SECONDS")
+ .DefaultValue(
+ ToString(Cork.Seconds()))
.StoreMappedResultT<const char*>(&Cork, &TDuration::Parse);
opts.AddLongOption(prefix + "on-message-in-pool")
- .RequiredArgument("BOOL")
- .DefaultValue(ToString(ExecuteOnMessageInWorkerPool))
+ .RequiredArgument("BOOL")
+ .DefaultValue(ToString(ExecuteOnMessageInWorkerPool))
.StoreResult(&ExecuteOnMessageInWorkerPool);
opts.AddLongOption(prefix + "on-reply-in-pool")
- .RequiredArgument("BOOL")
- .DefaultValue(ToString(ExecuteOnReplyInWorkerPool))
+ .RequiredArgument("BOOL")
+ .DefaultValue(ToString(ExecuteOnReplyInWorkerPool))
.StoreResult(&ExecuteOnReplyInWorkerPool);
}