diff options
author | max42 <max42@yandex-team.ru> | 2022-02-10 16:47:51 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:51 +0300 |
commit | 9988f7c537b40605e1a0aaae2977d5f540425b83 (patch) | |
tree | a4f3497f66e2dcd82d0f7ae7573acd1320d1bc78 | |
parent | 0a579de32b745908473b2cea7c5cd5540bc801f0 (diff) | |
download | ydb-9988f7c537b40605e1a0aaae2977d5f540425b83.tar.gz |
Restoring authorship annotation for <max42@yandex-team.ru>. Commit 1 of 2.
24 files changed, 246 insertions, 246 deletions
diff --git a/contrib/libs/c-ares/ares.h b/contrib/libs/c-ares/ares.h index 3f8a6954d0..48ebd95f6f 100644 --- a/contrib/libs/c-ares/ares.h +++ b/contrib/libs/c-ares/ares.h @@ -168,8 +168,8 @@ extern "C" { #define ARES_OPT_EDNSPSZ (1 << 15) #define ARES_OPT_NOROTATE (1 << 16) #define ARES_OPT_RESOLVCONF (1 << 17) -#define ARES_OPT_MAXTIMEOUTMS (1 << 18) -#define ARES_OPT_JITTER (1 << 19) +#define ARES_OPT_MAXTIMEOUTMS (1 << 18) +#define ARES_OPT_JITTER (1 << 19) /* Nameinfo flag values */ #define ARES_NI_NOFQDN (1 << 0) @@ -262,9 +262,9 @@ struct apattern; struct ares_options { int flags; int timeout; /* in seconds or milliseconds, depending on options */ - int maxtimeout; /* in milliseconds */ - int jitter; /* in .001 */ - unsigned int jitter_rand_seed; + int maxtimeout; /* in milliseconds */ + int jitter; /* in .001 */ + unsigned int jitter_rand_seed; int tries; int ndots; unsigned short udp_port; diff --git a/contrib/libs/c-ares/ares_init.c b/contrib/libs/c-ares/ares_init.c index e06265c6a2..29863f96e4 100644 --- a/contrib/libs/c-ares/ares_init.c +++ b/contrib/libs/c-ares/ares_init.c @@ -145,9 +145,9 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, */ channel->flags = -1; channel->timeout = -1; - channel->maxtimeout = -1; - channel->jitter = -1; - channel->jitter_rand_state = -1; + channel->maxtimeout = -1; + channel->jitter = -1; + channel->jitter_rand_state = -1; channel->tries = -1; channel->ndots = -1; channel->rotate = -1; @@ -353,8 +353,8 @@ int ares_save_options(ares_channel channel, struct ares_options *options, (*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TRIES|ARES_OPT_NDOTS| ARES_OPT_UDP_PORT|ARES_OPT_TCP_PORT|ARES_OPT_SOCK_STATE_CB| ARES_OPT_SERVERS|ARES_OPT_DOMAINS|ARES_OPT_LOOKUPS| - ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS|ARES_OPT_MAXTIMEOUTMS| - ARES_OPT_JITTER); + ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS|ARES_OPT_MAXTIMEOUTMS| + ARES_OPT_JITTER); (*optmask) |= (channel->rotate ? ARES_OPT_ROTATE : ARES_OPT_NOROTATE); if (channel->resolvconf_path) @@ -366,9 +366,9 @@ int ares_save_options(ares_channel channel, struct ares_options *options, /* We return full millisecond resolution but that's only because we don't set the ARES_OPT_TIMEOUT anymore, only the new ARES_OPT_TIMEOUTMS */ options->timeout = channel->timeout; - options->maxtimeout = channel->maxtimeout; - options->jitter = channel->jitter; - options->jitter_rand_seed = channel->jitter_rand_state; + options->maxtimeout = channel->maxtimeout; + options->jitter = channel->jitter; + options->jitter_rand_seed = channel->jitter_rand_state; options->tries = channel->tries; options->ndots = channel->ndots; options->udp_port = ntohs(aresx_sitous(channel->udp_port)); @@ -458,13 +458,13 @@ static int init_by_options(ares_channel channel, channel->timeout = options->timeout; else if ((optmask & ARES_OPT_TIMEOUT) && channel->timeout == -1) channel->timeout = options->timeout * 1000; - if ((optmask & ARES_OPT_MAXTIMEOUTMS) && channel->maxtimeout == -1) - channel->maxtimeout = options->maxtimeout; - if ((optmask & ARES_OPT_JITTER) && channel->jitter == -1) - { - channel->jitter = options->jitter; - channel->jitter_rand_state = options->jitter_rand_seed; - } + if ((optmask & ARES_OPT_MAXTIMEOUTMS) && channel->maxtimeout == -1) + channel->maxtimeout = options->maxtimeout; + if ((optmask & ARES_OPT_JITTER) && channel->jitter == -1) + { + channel->jitter = options->jitter; + channel->jitter_rand_state = options->jitter_rand_seed; + } if ((optmask & ARES_OPT_TRIES) && channel->tries == -1) channel->tries = options->tries; if ((optmask & ARES_OPT_NDOTS) && channel->ndots == -1) @@ -2337,24 +2337,24 @@ static int set_options(ares_channel channel, const char *str) val = try_option(p, q, "retrans:"); if (val && channel->timeout == -1) channel->timeout = aresx_sltosi(strtol(val, NULL, 10)); - val = try_option(p, q, "timeout:"); - if (val && channel->timeout == -1) - channel->timeout = aresx_sltosi(strtol(val, NULL, 10)) * 1000; - val = try_option(p, q, "maxtimeout:"); - if (val && channel->maxtimeout == -1) - channel->maxtimeout = aresx_sltosi(strtol(val, NULL, 10)) * 1000; + val = try_option(p, q, "timeout:"); + if (val && channel->timeout == -1) + channel->timeout = aresx_sltosi(strtol(val, NULL, 10)) * 1000; + val = try_option(p, q, "maxtimeout:"); + if (val && channel->maxtimeout == -1) + channel->maxtimeout = aresx_sltosi(strtol(val, NULL, 10)) * 1000; val = try_option(p, q, "retry:"); if (val && channel->tries == -1) channel->tries = aresx_sltosi(strtol(val, NULL, 10)); - val = try_option(p, q, "attempts:"); - if (val && channel->tries == -1) - channel->tries = aresx_sltosi(strtol(val, NULL, 10)); + val = try_option(p, q, "attempts:"); + if (val && channel->tries == -1) + channel->tries = aresx_sltosi(strtol(val, NULL, 10)); val = try_option(p, q, "rotate"); if (val && channel->rotate == -1) channel->rotate = 1; - val = try_option(p, q, "jitter:"); - if (val && channel->jitter == -1) - channel->jitter = aresx_sltosi(strtol(val, NULL, 10)); + val = try_option(p, q, "jitter:"); + if (val && channel->jitter == -1) + channel->jitter = aresx_sltosi(strtol(val, NULL, 10)); p = q; while (ISSPACE(*p)) p++; diff --git a/contrib/libs/c-ares/ares_private.h b/contrib/libs/c-ares/ares_private.h index 3312ed1932..a7624d9710 100644 --- a/contrib/libs/c-ares/ares_private.h +++ b/contrib/libs/c-ares/ares_private.h @@ -267,9 +267,9 @@ struct ares_channeldata { /* Configuration data */ int flags; int timeout; /* in milliseconds */ - int maxtimeout; /* in milliseconds */ - int jitter; /* in .001 */ - unsigned int jitter_rand_state; + int maxtimeout; /* in milliseconds */ + int jitter; /* in .001 */ + unsigned int jitter_rand_state; int tries; int ndots; int rotate; /* if true, all servers specified are used */ diff --git a/contrib/libs/c-ares/ares_process.c b/contrib/libs/c-ares/ares_process.c index 25095d0f05..403ba57ffc 100644 --- a/contrib/libs/c-ares/ares_process.c +++ b/contrib/libs/c-ares/ares_process.c @@ -898,27 +898,27 @@ void ares__send_query(ares_channel channel, struct query *query, } } - if (channel->maxtimeout != -1 && timeplus > channel->maxtimeout) - timeplus = channel->maxtimeout; - - if (channel->jitter != -1) - { - int r; - #ifdef WIN32 - /* Windows does not have rand_r function, so we use regular rand(). - * It is thread-unsafe, but it is better than nothing. - */ - r = rand(); - #else - r = rand_r(&channel->jitter_rand_state); - #endif - long long delta = (long long)(r - (RAND_MAX >> 1)) * timeplus * channel->jitter; - delta /= RAND_MAX; - /* Recall that jitter is expressed in .001 */ - delta /= 1000; - timeplus += delta; - } - + if (channel->maxtimeout != -1 && timeplus > channel->maxtimeout) + timeplus = channel->maxtimeout; + + if (channel->jitter != -1) + { + int r; + #ifdef WIN32 + /* Windows does not have rand_r function, so we use regular rand(). + * It is thread-unsafe, but it is better than nothing. + */ + r = rand(); + #else + r = rand_r(&channel->jitter_rand_state); + #endif + long long delta = (long long)(r - (RAND_MAX >> 1)) * timeplus * channel->jitter; + delta /= RAND_MAX; + /* Recall that jitter is expressed in .001 */ + delta /= 1000; + timeplus += delta; + } + query->timeout = *now; timeadd(&query->timeout, timeplus); /* Keep track of queries bucketed by timeout, so we can process diff --git a/contrib/libs/c-ares/test/ares-test-init.cc b/contrib/libs/c-ares/test/ares-test-init.cc index 842b0e15ac..cd03fad61f 100644 --- a/contrib/libs/c-ares/test/ares-test-init.cc +++ b/contrib/libs/c-ares/test/ares-test-init.cc @@ -242,32 +242,32 @@ TEST_F(LibraryTest, EnvInit) { ares_destroy(channel); } -TEST_F(LibraryTest, EnvInitYt) { - ares_channel channel = nullptr; - EnvValue v1("LOCALDOMAIN", "this.is.local"); - EnvValue v2("RES_OPTIONS", "options debug timeout:5 attempts:6"); - EXPECT_EQ(ARES_SUCCESS, ares_init(&channel)); - struct ares_options opts; - int optmask = 0; - ares_save_options(channel, &opts, &optmask); - EXPECT_EQ(5000, opts.timeout); - EXPECT_EQ(6, opts.tries); - ares_destroy(channel); -} - -TEST_F(LibraryTest, EnvInitYtTimeouts) { - ares_channel channel = nullptr; - EnvValue v1("LOCALDOMAIN", "this.is.local"); - EnvValue v2("RES_OPTIONS", "options debug jitter:42 maxtimeout:10"); - EXPECT_EQ(ARES_SUCCESS, ares_init(&channel)); - struct ares_options opts; - int optmask = 0; - ares_save_options(channel, &opts, &optmask); - EXPECT_EQ(42, opts.jitter); - EXPECT_EQ(10000, opts.maxtimeout); - ares_destroy(channel); -} - +TEST_F(LibraryTest, EnvInitYt) { + ares_channel channel = nullptr; + EnvValue v1("LOCALDOMAIN", "this.is.local"); + EnvValue v2("RES_OPTIONS", "options debug timeout:5 attempts:6"); + EXPECT_EQ(ARES_SUCCESS, ares_init(&channel)); + struct ares_options opts; + int optmask = 0; + ares_save_options(channel, &opts, &optmask); + EXPECT_EQ(5000, opts.timeout); + EXPECT_EQ(6, opts.tries); + ares_destroy(channel); +} + +TEST_F(LibraryTest, EnvInitYtTimeouts) { + ares_channel channel = nullptr; + EnvValue v1("LOCALDOMAIN", "this.is.local"); + EnvValue v2("RES_OPTIONS", "options debug jitter:42 maxtimeout:10"); + EXPECT_EQ(ARES_SUCCESS, ares_init(&channel)); + struct ares_options opts; + int optmask = 0; + ares_save_options(channel, &opts, &optmask); + EXPECT_EQ(42, opts.jitter); + EXPECT_EQ(10000, opts.maxtimeout); + ares_destroy(channel); +} + TEST_F(LibraryTest, EnvInitAllocFail) { ares_channel channel; EnvValue v1("LOCALDOMAIN", "this.is.local"); diff --git a/library/cpp/yt/memory/intrusive_ptr.h b/library/cpp/yt/memory/intrusive_ptr.h index 3dead7db1d..19ca6cb446 100644 --- a/library/cpp/yt/memory/intrusive_ptr.h +++ b/library/cpp/yt/memory/intrusive_ptr.h @@ -165,7 +165,7 @@ public: T* operator->() const noexcept { YT_ASSERT(T_); - return T_; + return T_; } explicit operator bool() const noexcept diff --git a/library/cpp/yt/memory/new-inl.h b/library/cpp/yt/memory/new-inl.h index 0a84818516..9f1d278cfe 100644 --- a/library/cpp/yt/memory/new-inl.h +++ b/library/cpp/yt/memory/new-inl.h @@ -43,7 +43,7 @@ struct TRefCountedWrapper final ~TRefCountedWrapper() = default; - void DestroyRefCounted() override + void DestroyRefCounted() override { T::DestroyRefCountedImpl(this); } @@ -63,7 +63,7 @@ public: ~TRefCountedWrapperWithDeleter() = default; - void DestroyRefCounted() override + void DestroyRefCounted() override { Deleter_(this); } @@ -84,7 +84,7 @@ struct TRefCountedWrapperWithCookie final ~TRefCountedWrapperWithCookie() = default; - void DestroyRefCounted() override + void DestroyRefCounted() override { T::DestroyRefCountedImpl(this); } @@ -173,14 +173,14 @@ struct TConstructHelper<T, true> template <class T, class... As> Y_FORCE_INLINE TIntrusivePtr<T> SafeConstruct(void* ptr, As&&... args) { - try { + try { auto* instance = TConstructHelper<T>::Construct(ptr, std::forward<As>(args)...); return TIntrusivePtr<T>(instance, false); - } catch (const std::exception& ex) { - // Do not forget to free the memory. + } catch (const std::exception& ex) { + // Do not forget to free the memory. TFreeMemory<T>::Do(ptr); - throw; - } + throw; + } } template <size_t Size, size_t Alignment> diff --git a/library/cpp/yt/memory/range.h b/library/cpp/yt/memory/range.h index 6c71aa9496..52bd649344 100644 --- a/library/cpp/yt/memory/range.h +++ b/library/cpp/yt/memory/range.h @@ -527,19 +527,19 @@ struct TIsPod<TMutableRange<T>> } // namespace NYT -template <class T> -struct hash<NYT::TRange<T>> -{ - size_t operator()(const NYT::TRange<T>& range) const - { - size_t result = 0; - for (const auto& element : range) { - NYT::HashCombine(result, element); - } - return result; - } -}; - +template <class T> +struct hash<NYT::TRange<T>> +{ + size_t operator()(const NYT::TRange<T>& range) const + { + size_t result = 0; + for (const auto& element : range) { + NYT::HashCombine(result, element); + } + return result; + } +}; + template <class T> struct hash<NYT::TMutableRange<T>> { @@ -552,5 +552,5 @@ struct hash<NYT::TMutableRange<T>> return result; } }; - + diff --git a/library/cpp/yt/memory/ref_counted.h b/library/cpp/yt/memory/ref_counted.h index b683615b83..d51cc87439 100644 --- a/library/cpp/yt/memory/ref_counted.h +++ b/library/cpp/yt/memory/ref_counted.h @@ -19,7 +19,7 @@ public: TRefCountedBase() = default; // Make destructor protected - virtual ~TRefCountedBase() noexcept = default; + virtual ~TRefCountedBase() noexcept = default; virtual void DestroyRefCounted() = 0; diff --git a/library/cpp/yt/memory/weak_ptr.h b/library/cpp/yt/memory/weak_ptr.h index 25a242bb8a..900f8250b8 100644 --- a/library/cpp/yt/memory/weak_ptr.h +++ b/library/cpp/yt/memory/weak_ptr.h @@ -246,25 +246,25 @@ TWeakPtr<T> MakeWeak(const TIntrusivePtr<T>& p) return TWeakPtr<T>(p); } -//! A helper for acquiring weak pointer for pointee, resetting intrusive pointer and then -//! returning the pointee reference count using the acquired weak pointer. -//! This helper is designed for best effort in checking that the object is not leaked after -//! destructing (what seems to be) the last pointer to it. -//! NB: it is possible to rewrite this helper making it working event with intrinsic refcounted objects, -//! but it requires much nastier integration with the intrusive pointer destruction routines. -template <typename T> -int ResetAndGetResidualRefCount(TIntrusivePtr<T>& pointer) -{ - auto weakPointer = MakeWeak(pointer); - pointer.Reset(); - if (pointer = weakPointer.Lock()) { - // This _may_ return 0 if we are again the only holder of the pointee. - return pointer->GetRefCount() - 1; - } else { - return 0; - } -} - +//! A helper for acquiring weak pointer for pointee, resetting intrusive pointer and then +//! returning the pointee reference count using the acquired weak pointer. +//! This helper is designed for best effort in checking that the object is not leaked after +//! destructing (what seems to be) the last pointer to it. +//! NB: it is possible to rewrite this helper making it working event with intrinsic refcounted objects, +//! but it requires much nastier integration with the intrusive pointer destruction routines. +template <typename T> +int ResetAndGetResidualRefCount(TIntrusivePtr<T>& pointer) +{ + auto weakPointer = MakeWeak(pointer); + pointer.Reset(); + if (pointer = weakPointer.Lock()) { + // This _may_ return 0 if we are again the only holder of the pointee. + return pointer->GetRefCount() - 1; + } else { + return 0; + } +} + //////////////////////////////////////////////////////////////////////////////// // TODO(sandello): Kill comparsions. diff --git a/library/cpp/yt/misc/guid.cpp b/library/cpp/yt/misc/guid.cpp index 882787d7a2..025afa85dd 100644 --- a/library/cpp/yt/misc/guid.cpp +++ b/library/cpp/yt/misc/guid.cpp @@ -99,22 +99,22 @@ bool TGuid::FromString(TStringBuf str, TGuid* result) return true; } -TGuid TGuid::FromStringHex32(TStringBuf str) -{ - TGuid guid; - if (!FromStringHex32(str, &guid)) { +TGuid TGuid::FromStringHex32(TStringBuf str) +{ + TGuid guid; + if (!FromStringHex32(str, &guid)) { throw TSimpleException(Sprintf("Error parsing Hex32 GUID \"%s\"", TString(str).c_str())); - } - return guid; -} - -bool TGuid::FromStringHex32(TStringBuf str, TGuid* result) -{ - if (str.size() != 32) { - return false; - } - + } + return guid; +} + +bool TGuid::FromStringHex32(TStringBuf str, TGuid* result) +{ + if (str.size() != 32) { + return false; + } + bool ok = true; int i = 0; auto parseChar = [&] { @@ -134,11 +134,11 @@ bool TGuid::FromStringHex32(TStringBuf str, TGuid* result) for (size_t j = 0; j < 16; ++j) { result->ReversedParts8[15 - j] = parseChar() * 16 + parseChar(); - } - + } + return ok; -} - +} + char* WriteGuidToBuffer(char* ptr, TGuid value) { auto writeHex1 = [&] (ui8 x) { diff --git a/library/cpp/yt/misc/guid.h b/library/cpp/yt/misc/guid.h index ec4ba3526a..303b6c31e7 100644 --- a/library/cpp/yt/misc/guid.h +++ b/library/cpp/yt/misc/guid.h @@ -70,12 +70,12 @@ struct TGuid //! Parses guid from TStringBuf, returns |true| if everything was ok. static bool FromString(TStringBuf str, TGuid* guid); - - //! Same as FromString, but expects exactly 32 hex digits without dashes. - static TGuid FromStringHex32(TStringBuf str); - - //! Same as TryFromString, but expects exactly 32 hex digits without dashes. - static bool FromStringHex32(TStringBuf str, TGuid* guid); + + //! Same as FromString, but expects exactly 32 hex digits without dashes. + static TGuid FromStringHex32(TStringBuf str); + + //! Same as TryFromString, but expects exactly 32 hex digits without dashes. + static bool FromStringHex32(TStringBuf str, TGuid* guid); }; bool operator == (TGuid lhs, TGuid rhs); diff --git a/library/cpp/yt/misc/port.h b/library/cpp/yt/misc/port.h index b24ac50995..88f5b8930a 100644 --- a/library/cpp/yt/misc/port.h +++ b/library/cpp/yt/misc/port.h @@ -11,10 +11,10 @@ // various insightful information on memory usage and object creation patterns. #define YT_ENABLE_REF_COUNTED_TRACKING -// This define enables logging with TRACE level. You can still disable trace logging -// for particular TU by discarding this macro identifier. -#define YT_ENABLE_TRACE_LOGGING - +// This define enables logging with TRACE level. You can still disable trace logging +// for particular TU by discarding this macro identifier. +#define YT_ENABLE_TRACE_LOGGING + #ifndef NDEBUG // This define enables thread affinity check -- a user-defined verification ensuring // that some functions are called from particular threads. diff --git a/library/cpp/yt/string/format-inl.h b/library/cpp/yt/string/format-inl.h index 5484d4a216..2e97c60049 100644 --- a/library/cpp/yt/string/format-inl.h +++ b/library/cpp/yt/string/format-inl.h @@ -85,11 +85,11 @@ inline void FormatValue(TStringBuilderBase* builder, TStringBuf value, TStringBu if (singleQuotes || doubleQuotes) { for (const char* valueCurrent = value.begin(); valueCurrent < value.end(); ++valueCurrent) { char ch = *valueCurrent; - if (ch == '\n') { - builder->AppendString("\\n"); - } else if (ch == '\t') { - builder->AppendString("\\t"); - } else if (ch < PrintableASCIILow || ch > PrintableASCIIHigh) { + if (ch == '\n') { + builder->AppendString("\\n"); + } else if (ch == '\t') { + builder->AppendString("\\t"); + } else if (ch < PrintableASCIILow || ch > PrintableASCIIHigh) { builder->AppendString("\\x"); builder->AppendChar(Int2Hex[static_cast<ui8>(ch) >> 4]); builder->AppendChar(Int2Hex[static_cast<ui8>(ch) & 0xf]); @@ -288,10 +288,10 @@ struct TValueFormatter<TFormatterWrapper<TFormatter>> }; // std::vector -template <class T, class TAllocator> -struct TValueFormatter<std::vector<T, TAllocator>> +template <class T, class TAllocator> +struct TValueFormatter<std::vector<T, TAllocator>> { - static void Do(TStringBuilderBase* builder, const std::vector<T, TAllocator>& collection, TStringBuf /*format*/) + static void Do(TStringBuilderBase* builder, const std::vector<T, TAllocator>& collection, TStringBuf /*format*/) { FormatRange(builder, collection, TDefaultFormatter()); } @@ -398,20 +398,20 @@ struct TValueFormatter<TEnumIndexedVector<E, T>> } }; -// std::pair -template <class T1, class T2> -struct TValueFormatter<std::pair<T1, T2>> -{ - static void Do(TStringBuilderBase* builder, const std::pair<T1, T2>& value, TStringBuf format) - { - builder->AppendChar('{'); - FormatValue(builder, value.first, format); +// std::pair +template <class T1, class T2> +struct TValueFormatter<std::pair<T1, T2>> +{ + static void Do(TStringBuilderBase* builder, const std::pair<T1, T2>& value, TStringBuf format) + { + builder->AppendChar('{'); + FormatValue(builder, value.first, format); builder->AppendString(TStringBuf(", ")); - FormatValue(builder, value.second, format); - builder->AppendChar('}'); - } -}; - + FormatValue(builder, value.second, format); + builder->AppendChar('}'); + } +}; + // std::optional inline void FormatValue(TStringBuilderBase* builder, std::nullopt_t, TStringBuf /*format*/) { diff --git a/library/cpp/yt/string/string.cpp b/library/cpp/yt/string/string.cpp index 7440ac3fdd..e3734288e8 100644 --- a/library/cpp/yt/string/string.cpp +++ b/library/cpp/yt/string/string.cpp @@ -130,7 +130,7 @@ char* WriteSignedIntToBufferBackwardsImpl(char* ptr, T value, TStringBuf min) // The negative value handling code below works incorrectly for min values. if (value == std::numeric_limits<T>::min()) { ptr -= min.length(); - ::memcpy(ptr, min.begin(), min.length()); + ::memcpy(ptr, min.begin(), min.length()); return ptr; } @@ -144,7 +144,7 @@ char* WriteSignedIntToBufferBackwardsImpl(char* ptr, T value, TStringBuf min) i64 rem = value % 100; i64 quot = value / 100; ptr -= 2; - ::memcpy(ptr, &DecimalDigits2[rem], 2); + ::memcpy(ptr, &DecimalDigits2[rem], 2); value = quot; } @@ -174,7 +174,7 @@ char* WriteUnsignedIntToBufferBackwardsImpl(char* ptr, T value) i64 rem = value % 100; i64 quot = value / 100; ptr -= 2; - ::memcpy(ptr, &DecimalDigits2[rem], 2); + ::memcpy(ptr, &DecimalDigits2[rem], 2); value = quot; } diff --git a/library/cpp/yt/string/string.h b/library/cpp/yt/string/string.h index ae6c99caab..84dcc899fc 100644 --- a/library/cpp/yt/string/string.h +++ b/library/cpp/yt/string/string.h @@ -33,11 +33,11 @@ static constexpr TStringBuf DefaultJoinToStringDelimiter = ", "; static constexpr TStringBuf DefaultKeyValueDelimiter = ": "; static constexpr TStringBuf DefaultRangeEllipsisFormat = "..."; -// ASCII characters from 0x20 = ' ' to 0x7e = '~' are printable. -static constexpr char PrintableASCIILow = 0x20; -static constexpr char PrintableASCIIHigh = 0x7e; -static constexpr TStringBuf Int2Hex = "0123456789abcdef"; - +// ASCII characters from 0x20 = ' ' to 0x7e = '~' are printable. +static constexpr char PrintableASCIILow = 0x20; +static constexpr char PrintableASCIIHigh = 0x7e; +static constexpr TStringBuf Int2Hex = "0123456789abcdef"; + //! Joins a range of items into a string intermixing them with the delimiter. /*! * \param builder String builder where the output goes. diff --git a/library/cpp/yt/string/string_builder.h b/library/cpp/yt/string/string_builder.h index 0e13e70904..92a6959eef 100644 --- a/library/cpp/yt/string/string_builder.h +++ b/library/cpp/yt/string/string_builder.h @@ -68,8 +68,8 @@ public: protected: TString Buffer_; - void DoReset() override; - void DoPreallocate(size_t size) override; + void DoReset() override; + void DoPreallocate(size_t size) override; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/library/cpp/yt/yson_string/string.cpp b/library/cpp/yt/yson_string/string.cpp index 99d45e8616..5dcd32f864 100644 --- a/library/cpp/yt/yson_string/string.cpp +++ b/library/cpp/yt/yson_string/string.cpp @@ -38,10 +38,10 @@ TYsonStringBuf::TYsonStringBuf(TStringBuf data, EYsonType type) , Null_(false) { } -TYsonStringBuf::TYsonStringBuf(const char* data, EYsonType type) - : TYsonStringBuf(TStringBuf(data), type) -{ } - +TYsonStringBuf::TYsonStringBuf(const char* data, EYsonType type) + : TYsonStringBuf(TStringBuf(data), type) +{ } + TYsonStringBuf::operator bool() const { return !Null_; diff --git a/library/cpp/yt/yson_string/string.h b/library/cpp/yt/yson_string/string.h index e13af37a6d..612aa6248c 100644 --- a/library/cpp/yt/yson_string/string.h +++ b/library/cpp/yt/yson_string/string.h @@ -21,23 +21,23 @@ public: //! Constructs an instance from TYsonString. TYsonStringBuf(const TYsonString& ysonString); - //! Constructs a non-null instance with given type and content. + //! Constructs a non-null instance with given type and content. explicit TYsonStringBuf( const TString& data, EYsonType type = EYsonType::Node); - //! Constructs a non-null instance with given type and content. + //! Constructs a non-null instance with given type and content. explicit TYsonStringBuf( TStringBuf data, EYsonType type = EYsonType::Node); - //! Constructs a non-null instance with given type and content - //! (without this overload there is no way to construct TYsonStringBuf from - //! string literal). - explicit TYsonStringBuf( - const char* data, - EYsonType type = EYsonType::Node); - + //! Constructs a non-null instance with given type and content + //! (without this overload there is no way to construct TYsonStringBuf from + //! string literal). + explicit TYsonStringBuf( + const char* data, + EYsonType type = EYsonType::Node); + //! Returns |true| if the instance is not null. explicit operator bool() const; diff --git a/library/python/svn_version/__svn_version.pyx b/library/python/svn_version/__svn_version.pyx index d66bc09d24..6df8e97a57 100644 --- a/library/python/svn_version/__svn_version.pyx +++ b/library/python/svn_version/__svn_version.pyx @@ -5,7 +5,7 @@ cdef extern from "library/cpp/svnversion/svnversion.h": cdef int GetProgramSvnRevision() except +; cdef int GetArcadiaLastChangeNum() except +; cdef const char* GetProgramCommitId() except +; - cdef const char* GetProgramHash() except +; + cdef const char* GetProgramHash() except +; cdef const char* GetBranch() except +; cdef const char* GetTag() except +; cdef int GetArcadiaPatchNumber() except +; @@ -22,9 +22,9 @@ def svn_last_revision(): def commit_id(): return fu.bytes_to_native_str(GetProgramCommitId()) -def hash(): - return fu.bytes_to_native_str(GetProgramHash()) - +def hash(): + return fu.bytes_to_native_str(GetProgramHash()) + def svn_branch(): return fu.bytes_to_native_str(GetBranch()) diff --git a/library/python/svn_version/ut/lib/test_simple.py b/library/python/svn_version/ut/lib/test_simple.py index 2c27af6c68..13304cf2de 100644 --- a/library/python/svn_version/ut/lib/test_simple.py +++ b/library/python/svn_version/ut/lib/test_simple.py @@ -12,5 +12,5 @@ def test_simple(): assert sv.commit_id() assert isinstance(sv.commit_id(), str) assert len(sv.commit_id()) > 0 - assert isinstance(sv.hash(), str) + assert isinstance(sv.hash(), str) assert isinstance(sv.patch_number(), int) diff --git a/util/generic/size_literals.h b/util/generic/size_literals.h index 0b78b18687..142052d05c 100644 --- a/util/generic/size_literals.h +++ b/util/generic/size_literals.h @@ -22,14 +22,14 @@ constexpr ui64 operator"" _TB(unsigned long long value) noexcept { return value * 1024_GB; } -constexpr ui64 operator"" _PB(unsigned long long value) noexcept { - return value * 1024_TB; -} - -constexpr ui64 operator"" _EB(unsigned long long value) noexcept { - return value * 1024_PB; -} - +constexpr ui64 operator"" _PB(unsigned long long value) noexcept { + return value * 1024_TB; +} + +constexpr ui64 operator"" _EB(unsigned long long value) noexcept { + return value * 1024_PB; +} + // Signed literals namespace NPrivate { @@ -55,11 +55,11 @@ constexpr i64 operator"" _GBs(unsigned long long value) noexcept { constexpr i64 operator"" _TBs(unsigned long long value) noexcept { return ::NPrivate::SignedCast(value * 1024_GB); } - -constexpr i64 operator"" _PBs(unsigned long long value) noexcept { - return ::NPrivate::SignedCast(value * 1024_TB); -} - -constexpr i64 operator"" _EBs(unsigned long long value) noexcept { - return ::NPrivate::SignedCast(value * 1024_PB); -} + +constexpr i64 operator"" _PBs(unsigned long long value) noexcept { + return ::NPrivate::SignedCast(value * 1024_TB); +} + +constexpr i64 operator"" _EBs(unsigned long long value) noexcept { + return ::NPrivate::SignedCast(value * 1024_PB); +} diff --git a/util/generic/size_literals_ut.cpp b/util/generic/size_literals_ut.cpp index 410e22c39d..70b37ac23a 100644 --- a/util/generic/size_literals_ut.cpp +++ b/util/generic/size_literals_ut.cpp @@ -21,14 +21,14 @@ void CompileTestUnsigned() { static_assert(57_TB == 57_GB * 1024, "Wrong 57TB value"); static_assert(1023_TB == 1023_GB * 1024, "Wrong 1023TB value"); - static_assert(1_PB == 1_TB * 1024, "Wrong 1PB value"); - static_assert(9_PB == 9_TB * 1024, "Wrong 9PB value"); - static_assert(42_PB == 42_TB * 1024, "Wrong 42PB value"); - static_assert(1023_PB == 1023_TB * 1024, "Wrong 1023PB value"); - - static_assert(1_EB == 1_PB * 1024, "Wrong 1EB value"); - static_assert(9_EB == 9_PB * 1024, "Wrong 9EB value"); - + static_assert(1_PB == 1_TB * 1024, "Wrong 1PB value"); + static_assert(9_PB == 9_TB * 1024, "Wrong 9PB value"); + static_assert(42_PB == 42_TB * 1024, "Wrong 42PB value"); + static_assert(1023_PB == 1023_TB * 1024, "Wrong 1023PB value"); + + static_assert(1_EB == 1_PB * 1024, "Wrong 1EB value"); + static_assert(9_EB == 9_PB * 1024, "Wrong 9EB value"); + static_assert(9000000_TB == 9000000_GB * 1024, "Wrong 9000000TB value"); } @@ -53,14 +53,14 @@ void CompileTestSigned() { static_assert(57_TBs == 57_GBs * 1024, "Wrong 57TBs value"); static_assert(1023_TBs == 1023_GBs * 1024, "Wrong 1023TBs value"); - static_assert(1_PBs == 1_TBs * 1024, "Wrong 1PBs value"); - static_assert(9_PBs == 9_TBs * 1024, "Wrong 9PBs value"); - static_assert(42_PBs == 42_TBs * 1024, "Wrong 42PBs value"); - static_assert(1023_PBs == 1023_TBs * 1024, "Wrong 1023PBs value"); - - static_assert(1_EBs == 1_PBs * 1024, "Wrong 1EBs value"); - static_assert(7_EBs == 7_PBs * 1024, "Wrong 7EBs value"); - + static_assert(1_PBs == 1_TBs * 1024, "Wrong 1PBs value"); + static_assert(9_PBs == 9_TBs * 1024, "Wrong 9PBs value"); + static_assert(42_PBs == 42_TBs * 1024, "Wrong 42PBs value"); + static_assert(1023_PBs == 1023_TBs * 1024, "Wrong 1023PBs value"); + + static_assert(1_EBs == 1_PBs * 1024, "Wrong 1EBs value"); + static_assert(7_EBs == 7_PBs * 1024, "Wrong 7EBs value"); + static_assert(8388607_TBs == 8388607_GBs * 1024, "Wrong 8388607TBs value"); // 2**23 - 1 TB // Should cause compilation error if uncommented diff --git a/ydb/library/yql/providers/common/proto/gateways_config.proto b/ydb/library/yql/providers/common/proto/gateways_config.proto index 8561fe2536..631f3ecb9c 100644 --- a/ydb/library/yql/providers/common/proto/gateways_config.proto +++ b/ydb/library/yql/providers/common/proto/gateways_config.proto @@ -299,17 +299,17 @@ message TStatGatewayConfig { repeated TAttr DefaultSettings = 102; } -///////////////////////////// CHYT ///////////////////////////// - -message TChytClusterConfig { - optional string Name = 1; // Short cluster name - optional string YtCluster = 2; // Name of the corresponding YT cluster. -} - -message TChytGatewayConfig { - repeated TChytClusterConfig ClusterMapping = 1; -} - +///////////////////////////// CHYT ///////////////////////////// + +message TChytClusterConfig { + optional string Name = 1; // Short cluster name + optional string YtCluster = 2; // Name of the corresponding YT cluster. +} + +message TChytGatewayConfig { + repeated TChytClusterConfig ClusterMapping = 1; +} + ///////////////////////////// S3 ///////////////////////////// message TS3ClusterConfig { @@ -442,7 +442,7 @@ message TGatewaysConfig { optional TRtmrGatewayConfig Rtmr = 4; optional TKikimrMvpGatewayConfig KikimrMvp = 5; optional TStatGatewayConfig Stat = 6; - optional TChytGatewayConfig Chyt = 7; + optional TChytGatewayConfig Chyt = 7; optional TSolomonGatewayConfig Solomon = 8; optional TFileStorageAdditionalConfig Fs = 9; optional TYqlCoreConfig YqlCore = 10; |